Steady squares: Difference between revisions

Content added Content deleted
(Added ABC)
(→‎{{header|ABC}}: Better (?) code)
Line 7: Line 7:
=={{header|ABC}}==
=={{header|ABC}}==
<syntaxhighlight lang="abc">
<syntaxhighlight lang="abc">
HOW TO REPORT n is.steady.square power.of.ten:
HOW TO REPORT n is.steady.square.below power.of.ten:
REPORT ( n * n ) mod power.of.ten = n
REPORT ( n * n ) mod power.of.ten = n


HOW TO REPORT n show.possible.steady.square power.of.ten:
HOW TO MIGHT n BE A STEADY SQUARE BELOW power.of.ten:
IF n is.steady.square power.of.ten:
IF n is.steady.square.below power.of.ten:
WRITE ( ( ( n << 1 ) ^ "^2 = " ) >> 10 ) ^ ( ( n * n ) >> 1 ) /
WRITE ( ( ( n << 1 ) ^ "^2 = " ) >> 10 ) ^ ( ( n * n ) >> 1 ) /
SUCCEED


PUT 10 IN power.of.ten
PUT 10 IN power.of.ten
Line 21: Line 20:
IF n = power.of.ten:
IF n = power.of.ten:
PUT power.of.ten * 10 IN power.of.ten
PUT power.of.ten * 10 IN power.of.ten
IF ( n + 1 ) show.possible.steady.square power.of.ten: PASS
MIGHT ( n + 1 ) BE A STEADY SQUARE BELOW power.of.ten
IF ( n + 5 ) show.possible.steady.square power.of.ten: PASS
MIGHT ( n + 5 ) BE A STEADY SQUARE BELOW power.of.ten
IF ( n + 6 ) show.possible.steady.square power.of.ten: PASS
MIGHT ( n + 6 ) BE A STEADY SQUARE BELOW power.of.ten
</syntaxhighlight>
</syntaxhighlight>
{{out}}
{{out}}