I wouldn't interpolate $a in the for loop. Or 1. Makes me kind of wonder what influenced you to do so.
In reply to Re: Powers of three by zshzn in thread Powers of three by simcop2387