Sum of square and cube digits of an integer are primes: Difference between revisions
Content added Content deleted
Not a robot (talk | contribs) (Add CLU) |
(→{{header|ALGOL 68}}: Use a more sensible sieve size) |
||
Line 16: | Line 16: | ||
INT max number = 99; # maximum number to consider # |
INT max number = 99; # maximum number to consider # |
||
PR read "primes.incl.a68" PR |
PR read "primes.incl.a68" PR |
||
[]BOOL prime = PRIMESIEVE ( |
[]BOOL prime = PRIMESIEVE ( INT d sum := 9; # calculate the largest possible digit sum # |
||
INT n := max number * max number * max number; |
|||
WHILE ( n OVERAB 10 ) > 0 DO |
|||
d sum +:= 9 |
|||
OD; |
|||
d sum |
|||
); |
|||
# returns the sum of the digits of n # |
# returns the sum of the digits of n # |
||
OP DIGITSUM = ( INT n )INT: |
OP DIGITSUM = ( INT n )INT: |