A380434 Lexicographically earliest sequence of distinct positive integers such that for any n > 0, the initial digit of n divides a(n) or the initial digit of a(n) divides n.
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 21, 24, 23, 26, 25, 28, 27, 30, 29, 33, 36, 31, 39, 42, 32, 45, 48, 34, 40, 44, 35, 52, 41, 37, 56, 60, 38, 64, 50, 55, 43, 65, 61, 51, 46, 70, 75, 80, 47, 54, 66, 71, 49, 53, 62, 72
Offset: 1
Links
- Rémy Sigrist, Table of n, a(n) for n = 1..12000
- Rémy Sigrist, Scatterplot of the first 120000 terms
- Rémy Sigrist, PARI program
- Index entries for sequences that are permutations of the natural numbers
Programs
-
PARI
\\ See Links section.
-
Python
from itertools import count, islice def agen(): # generator of terms aset, m = set(), 1 for n in count(1): n1 = int(str(n)[0]) an = next(k for k in count(m) if k not in aset and (k%n1 == 0 or n%int(str(k)[0]) == 0)) yield an aset.add(an) while m in aset: m += 1 print(list(islice(agen(), 67))) # Michael S. Branicky, Jan 27 2025
Comments