This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A308539 #27 Jan 27 2025 09:40:00 %S A308539 1,2,4,8,16,3,6,12,5,10,7,14,9,18,11,13,15,17,19,20,22,24,26,28,30,21, %T A308539 32,27,34,33,36,39,42,40,44,48,52,25,38,45,56,35,51,50,55,60,54,65,66, %U A308539 72,49,64,78,63,84,80,88,96,81,104,23,46,68,90,99,108,29 %N A308539 Lexicographically earliest sequence of distinct positive terms such that for any n > 0, the initial digit of a(n) divides a(n+1). %C A308539 This sequence is a permutation of the natural numbers (with inverse A308541): %C A308539 - for any nonzero digit d, there are infinitely many multiples of d, hence we can always extend the sequence, %C A308539 - by the pigeonhole principle, for some nonzero digit t, there are infinitely many terms with initial digit t, %C A308539 - so eventually every multiple of t will appear in the sequence, %C A308539 - after a term with initial digit 1, we can always extend the sequence with the least natural number not yet in the sequence, %C A308539 - as there are infinitely many multiples of t with initial digit 1, so infinitely many terms with initial digit 1, every natural number will eventually appear, QED. %H A308539 Rémy Sigrist, <a href="/A308539/b308539.txt">Table of n, a(n) for n = 1..10000</a> %H A308539 Rémy Sigrist, <a href="/A308539/a308539.png">Colored scatterplot of the first 100000 terms</a> (where the color is function of the initial digits of a(n-1)) %H A308539 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %e A308539 a(1) = 1. %e A308539 a(2) = 2 as it is the first multiple of 1 not yet in the sequence. %e A308539 a(3) = 4 as it is the first multiple of 2 not yet in the sequence. %e A308539 a(4) = 8 as it is the first multiple of 4 not yet in the sequence. %e A308539 a(5) = 16 as it is the first multiple of 8 not yet in the sequence. %e A308539 a(6) = 3 as it is the first multiple of 1 not yet in the sequence. %t A308539 a[1] = 1; a[n_] := a[n] = Block[{k = 2}, While[Mod[k, First@IntegerDigits[a[n - 1]]] != 0 || MemberQ[Array[a, n - 1], k], k++]; k]; Array[a, 67] (* _Giorgos Kalogeropoulos_, May 12 2023 *) %o A308539 (PARI) { s=0; v=1; u=1; for (n=1, 67, print1 (v ", "); s+=2^v; while (bittest(s,u), u++); forstep (w=ceil(u/d=digits(v)[1])*d, oo, d, if (!bittest(s,w), v=w; break))) } %o A308539 (Python) %o A308539 from itertools import count, islice %o A308539 def agen(): # generator of terms %o A308539 an, aset, m = 1, {1}, 1 %o A308539 while True: %o A308539 yield an %o A308539 an1 = int(str(an)[0]) %o A308539 an = next(k for k in count(m) if k not in aset and k%an1 == 0) %o A308539 aset.add(an) %o A308539 while m in aset: m += 1 %o A308539 print(list(islice(agen(), 67))) # _Michael S. Branicky_, Jan 27 2025 %Y A308539 See A248024 for a similar sequence. %Y A308539 Cf. A000030, A308541 (inverse). %K A308539 nonn,base %O A308539 1,2 %A A308539 _Rémy Sigrist_, Jun 06 2019