OFFSET
0,4
COMMENTS
At n = 208666297 this sequence enters a cycle that has a period of 300056874 and begins: 2847, 26331, 5851, ... (only the first 3 terms of the cycle are needed to reproduce the entire cycle).
This can be compared with the sequence A243063, which enters a cycle that has a (relatively) small period of 912.
FORMULA
a(n) = Zr(a(n-1) + a(n-2) + a(n-3)), where the function Zr(k) removes all zero digits from k.
EXAMPLE
a(9) = Zr(a(8) + a(7) + a(6)) = Zr(17 + 31 + 57) = Zr(105) = 15.
MATHEMATICA
a[0]=a[1]=a[2]=1; a[n_]:=FromDigits[DeleteCases[IntegerDigits[a[n-1]+a[n-2]+a[n-3]], 0]]; Array[a, 50, 0] (* Stefano Spezia, Apr 12 2024 *)
PROG
(Python)
def a(n):
a, b, c = 1, 1, 1
for _ in range(n):
a, b, c = b, c, int(str(a+b+c).replace('0', ''))
return a
(Python) # faster for initial segment of sequence
from itertools import islice
def agen(): # generator of terms
a, b, c = 1, 1, 1
while True: yield a; a, b, c = b, c, int(str(a+b+c).replace("0", ""))
print(list(islice(agen(), 50))) # Michael S. Branicky, Apr 13 2024
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Bryle Morga, Apr 11 2024
STATUS
approved