#n的十进制展开式中的n->0和1子配置文件{my$n=班次;$n=~s/[2-9]+//g;返回$n;}#长度x前缀->以前缀开头的长度配置文件子配置文件{my$len=班次;my$prefix=shift;if($len==长度($prefix)){return($prefix);}其他{return(配置文件($len,$prefix.“0”),配置文件($len,$prefix.“1”);}}我的$未通过=1;我的%next_with_profile=();#配置文件->具有给定配置文件的下一个未使用的数字sub next_with_profile(包含配置文件){我的$profile=班次;while(${$next_with_profile{$profile}}<0){推送@{$next_with_profile{profile($uncassed)}}=>$unpassed;$未通过++;}返回$next_with_profile{$profile}[0];}#n->消耗n次级消费{my$n=班次;我的$profile=配置文件($n);如果$next_with_profile{$profile}[0]ne$n,则死亡;移动@{$next_with_profile{$profile}};}我的$carry=“”;subcompute_next_term{my$best=next_with_profile(“”);foreach my$len(1..长度($best)){foreach my$配置文件(配置文件($len,substr($carry,0,$len)){my$other=next_with_profile($profile);if($best>$other){$best=$其他;}}}消费($best);$carry=substr($carry.sprintf(“%b”,$best),长度(profile($best)));返回$best;}我的$prev=0;我的$i=0;每个我的$(1..32062){my$a=compute_next_term($n);if(($prev<=$n-1)!=($a≤$n){打印++$i,“”,$n-1,“\n”;最后一个条件是$i==10_000;}$prev=$a;}