editing
approved
editing
approved
b:= proc(n) option remember; `if`(n<2, 3*n,
irem(b(n-1)+3*(9*b(n-1)^3+7), 10^n))
end:
a:= n-> (b(n+1)-b(n))/10^n:
seq(a(n), n=0..100); # Alois P. Heinz, Apr 14 2022
approved
editing
reviewed
approved
proposed
reviewed
editing
proposed
b = (a + 3 * (9 * a ** 3 - + 7)) % (10 ** (i + 2))
Define the sequence {b(n)} by the recurrence b(0) = 0 and b(1) = 7, 3, b(n) = b(n-1) + 3 * (9 * b(n-1)^3 + 7) mod 10^n for n > 1, then a(n) = (b(n+1) - b(n))/10^n. - Seiichi Manyama, Aug 13 2019
(Ruby)
def A225401(n)
ary = [3]
a = 3
n.times{|i|
b = (a + 3 * (9 * a ** 3 - 7)) % (10 ** (i + 2))
ary << (b - a) / (10 ** (i + 1))
a = b
}
ary
end
p A225401(100) # Seiichi Manyama, Aug 13 2019
Define the sequence {b(n)} by the recurrence b(0) = 0 and b(1) = 7, b(n) = b(n-1) + 3 * (9 * b(n-1)^3 + 7) mod 10^n for n > 1, then a(n) = (b(n+1) - b(n))/10^n. - Seiichi Manyama, Aug 13 2019
approved
editing
proposed
approved
editing
proposed