18 lines
489 B
Plaintext
18 lines
489 B
Plaintext
/* Function that returns a list of digits given a nonnegative integer */
|
|
decompose(num) := block([digits, remainder],
|
|
digits: [],
|
|
while num > 0 do
|
|
(remainder: mod(num, 10),
|
|
digits: cons(remainder, digits),
|
|
num: floor(num/10)),
|
|
digits
|
|
)$
|
|
|
|
/* Routine that extracts from primes between 2 and 500, inclusive, the additive primes */
|
|
block(
|
|
primes(2,500),
|
|
sublist(%%,lambda([x],primep(apply("+",decompose(x))))));
|
|
|
|
/* Number of additive primes in the rank */
|
|
length(%);
|