OFFSET
1,2
COMMENTS
Every positive integer appears twice in the present sequence:
- we can always extend the sequence with a value not yet in the sequence,
- for any n > 1, a(n) is at most one plus the greatest value so far,
- every integer appears at least once in the sequence (for any v > 0, v necessarily appears at least once among the 2*v-1 initial terms),
- for any v > 0, the first occurrence of v appears before the first occurrence of v+1,
- every integer appears twice in the sequence: for any v > 0, the value 10*v appears after the first occurrence of v, so eventually v must appear a second time.
LINKS
Rémy Sigrist, Table of n, a(n) for n = 1..10000
Rémy Sigrist, Perl program
PROG
(Perl) # See Links section.
(Python)
from itertools import count, islice
def agen(): # generator of terms
adict, an, m, s, sn = dict(), 1, 1, "", [None]
for n in count(1):
yield an
s += str(an)
sn.append(len(s))
adict[an] = [n] if an not in adict else adict[an] + [n]
an = next(k for k in count(m) if k not in adict or (len(adict[k])==1 and str(k) in s[sn[adict[k][0]]:]))
while m in adict and len(adict[m]) > 1: m += 1
print(list(islice(agen(), 70))) # Michael S. Branicky, Jan 19 2025
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Jan 19 2025
STATUS
approved
