15 lines
453 B
Plaintext
15 lines
453 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
|
|
)$
|
|
|
|
/* Test case */
|
|
block(babbage_param:269696,i:isqrt(babbage_param)+1,cache_babbage:decompose(babbage_param),
|
|
while rest(decompose(i^2),(length(decompose(i^2))-6))#cache_babbage do i:i+2,
|
|
i);
|