Steady squares: Difference between revisions
→{{header|PROMAL}}: Simplify
(→{{header|Action!}}: Simplify) |
(→{{header|PROMAL}}: Simplify) |
||
Line 1,458:
=={{header|PROMAL}}==
As
<syntaxhighlight lang="promal">
PROGRAM steadySquares
INCLUDE LIBRARY
WORD p ; the number to square, with the final digit replaced by 0
WORD n ; the number to square
WORD d10 ; 10^the number of digits in p, n
WORD s ; the square of n modulo d10
WORD f ; loop counter to choose 1, 5 or 6 as the final digit of n
WORD
WORD back ; the last two digits of n
BEGIN
d10 = 10
Line 1,485 ⟶ 1,487:
IF n <= 255
s = ( n * n )
s = ( n * ( ( n ) % 10 ) % 1000 )▼
ELSE
▲ k = n % 1000
s = s % d10
IF s = n
|