Jump to content

Idoneal numbers: Difference between revisions

→‎{{header|Action!}}: Simplification - don't need a loop to find c
(→‎{{header|ALGOL 68}}: Further simplification - don't need a loop to find c)
(→‎{{header|Action!}}: Simplification - don't need a loop to find c)
Line 34:
count = 0 maxCount = 65
n = 0
n2 = n - 2 ; n2 will be 65534 = -2
WHILE count < maxCount DO
n ==+ 1
Line 43:
b = a + 1
DO
ab = a * b
IF ( ab + a + b ) > n OR idonealsum = 0 THEN EXIT FI
cIF =ab b< +n 1THEN
DO c = ( n - ab ) / ( a + b )
sum = ab + ( c * ( b + a ) )
IF c > b AND sum = n THEN idoneal = 0 FI
b idoneal ==+ 01
EXITFI
UNTIL sum > n ELSEIFOR sumidoneal = 0 OR ab >= n THEN
EXIT
ELSE
c ==+ 1
FI
OD
b ==+ 1
OD
a ==+ 1
3,048

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.