login
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
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,2
COMMENTS
This sequence is a self-inverse permutation of the positive integers.
PROG
(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
CROSSREFS
Sequence in context: A089867 A089870 A089869 * A358121 A335524 A338555
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Jan 24 2025
STATUS
approved