RosettaCodeData/Task/Magic-constant/Sidef/magic-constant.sidef

15 lines
276 B
Plaintext

func f(n) {
(n+2) * ((n+2)**2 + 1) / 2
}
func order(n) {
iroot(2*n, 3) + 1
}
say ("First 20 terms: ", f.map(1..20).join(' '))
say ("1000th term: ", f(1000), " with order ", order(f(1000)))
for n in (1 .. 20) {
printf("order(10^%-2s) = %s\n", n, order(10**n))
}