A378107 Lexicographically earliest sequence of distinct positive integers such that for any n > 0, either a(n+1) is a multiple of a(n) or the decimal expansion of a(n+1) appears in that of a(n).
1, 2, 4, 8, 16, 6, 12, 24, 48, 96, 9, 18, 36, 3, 15, 5, 10, 20, 40, 80, 160, 60, 120, 240, 480, 960, 1920, 19, 38, 76, 7, 14, 28, 56, 112, 11, 22, 44, 88, 176, 17, 34, 68, 136, 13, 26, 52, 104, 208, 416, 41, 82, 164, 64, 128, 256, 25, 50, 100, 200, 400, 800
Offset: 1
Examples
The first terms are: n a(n) -- ---- 1 1 2 2 3 4 4 8 5 16 6 6 (6 appears in 16) 7 12 8 24 9 48 10 96 11 9 (9 appears in 96) 12 18 13 36 14 3 (3 appears in 36) 15 15
Links
- Rémy Sigrist, Table of n, a(n) for n = 1..10000
- Rémy Sigrist, PARI program
Programs
-
PARI
\\ See Links section.
-
Python
from itertools import combinations, count, islice def agen(): # generator of terms an, aset = 1, {0, 1} while True: yield an s = str(an) subs = (int(s[i:j]) for i, j in combinations(range(len(s)+1), 2)) an1 = min((t for t in subs if t not in aset), default=-1) if an1 == -1: an = next(k*an for k in count(2) if k*an not in aset) else: an = an1 aset.add(an) print(list(islice(agen(), 62))) # Michael S. Branicky, Nov 17 2024
Comments