Fractran: Difference between revisions

Content added Content deleted
(→‎{{header|Phix}}: bugfix: prime_factors(1) now returns {1}, upped the ante)
m (→‎{{header|Phix}}: improved comments)
Line 2,762: Line 2,762:


Notice that 2, being a power of 2, has zero in all slots other than 2.<br>
Notice that 2, being a power of 2, has zero in all slots other than 2.<br>
We can say that 15 is not exactly divisible by 2 because the power of 2 is too large, i.e, comparing {1,0,0} with {0,1,1} there is a 1>0 in the 2 slot.<br>
We can say that (eg) 15 is not exactly divisible by 2 because an sq_sub({0,1,1},{1,0,0}) would contain some <0s.<br>
We can also say that 15 is not a power of 2 because there are non-0 in other than n[find(2,known_factors)].<br>
Division (to whole integer) is performed simply by subtracting the corresponding powers.
Division (to whole integer) is performed simply by subtracting the corresponding powers, as above not possible if any would be negative.


<lang Phix>constant steps = 20,
<lang Phix>constant steps = 20,