a simple note, it'll use 2*(2**$a) array elements, and is probably O(2**n) in memory usage and cpu time, so its probably one of the more ineffecient ways to calculate powers of three in existence$a=24;@a=(1);sub d{push@a,map{2*$_}@a}; d for('1'.."$a");$b=$#a;$_=0; push@b,$_+=$a[$#a-$b--] until($b==-1); print$b[2**$a-1];
In reply to Powers of three by simcop2387
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |