OFFSET
1,5
COMMENTS
Van Eck-like sequence using the sum of the decimal digits of the previous term as lookup key. It agrees with Van Eck's sequence A181391 for the first 30 terms a(1)..a(30). The sequences first differ at a(31): A181391 has 0, this sequence has 11, because digsum(a(30)) = digsum(14) = 5, and 5 last appeared at index 19, giving distance 30-19=11.
Among the first 10^6 terms there are 26 zeros, see A398307. No further zero was found through n=10^6. It is conjectured that these are all the zeros.
Empirically, a(n)/n appears to approach 1. In particular, a(10^4)=9365, a(10^5)=99353 and a(10^6)=999847. Conjecture: lim_{n->oo} a(n)/n=1.
LINKS
Bence BernĂ¡th, Table of n, a(n) for n = 1..10000
EXAMPLE
a(30)=14, digsum of 14 is 5, the most recent occurrence of 5 was at a(19), so a(31)=30-19=11.
PROG
(Python)
def A398259_list(n):
if n <= 0:
return []
seq = [0]
term_last = {}
for ii in range(n - 1):
v = seq[ii]
s = sum(int(ch) for ch in str(v))
new = (ii - term_last[s]) if s in term_last else 0
term_last[v] = ii
seq.append(new)
return seq
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Bence BernĂ¡th, Jul 24 2026
STATUS
approved