19 lines
507 B
Text
19 lines
507 B
Text
with javascript_semantics
|
|
|
|
function magic(integer nth)
|
|
integer order = nth+2
|
|
return (order*order+1)/2 * order
|
|
end function
|
|
printf(1,"First 20 magic constants: %V\n",{apply(tagset(20),magic)})
|
|
printf(1,"1000th magic constant: %,d\n",{magic(1000)})
|
|
|
|
include mpfr.e
|
|
|
|
mpz {goal, order} = mpz_inits(2)
|
|
for i=1 to 20 do
|
|
mpz_ui_pow_ui(goal,10,i)
|
|
mpz_mul_si(order,goal,2)
|
|
mpz_nthroot(order,order,3)
|
|
mpz_add_si(order,order,1)
|
|
printf(1,"1e%d: %s\n",{i,mpz_get_str(order,10,true)})
|
|
end for
|