login
A351629
a(1) = 1, a(2) = 2 and a(n) is the smallest integer not included earlier whose first digit divides the concatenation a(n-2), a(n-1).
2
1, 2, 3, 10, 5, 7, 11, 9, 12, 4, 13, 14, 6, 15, 16, 17, 18, 19, 100, 20, 21, 101, 102, 22, 23, 30, 24, 8, 25, 31, 103, 104, 26, 27, 105, 32, 28, 29, 33, 70, 50, 34, 35, 36, 40, 41, 37, 38, 39, 106, 107, 108, 42, 60, 43, 109, 110, 51, 111, 90, 52, 44, 45, 53, 112, 46, 113, 114, 115, 54, 116, 47
OFFSET
1,2
COMMENTS
The sequence is a permutation of the positive integers.
LINKS
Michael De Vlieger, Log-log scatterplot of a(n), n = 1..2^14.
EXAMPLE
a(3) = 3 as 3 is the smallest unused integer whose first digit divides 12;
a(4) = 10 as 10 is the smallest unused integer whose first digit divides 23;
a(5) = 5 as 5 is the smallest unused integer whose first digit divides 310;
a(6) = 7 as 7 is the smallest unused integer whose first digit divides 105; etc.
MATHEMATICA
c[_] = 0; u = 1; a[1] = c[1] = 1; a[2] = c[2] = 2; nn = 72; Do[While[c[u] > 0, u++]; k = u; m = a[n - 2]*10^IntegerLength[a[n - 1]] + a[n - 1]; While[Nand[Mod[m, First@ IntegerDigits[k]] == 0, c[k] == 0], k++]; a[n] = k; c[k] = n, {n, 3, nn}]; Array[a[#] &, nn] (* Michael De Vlieger, Feb 20 2022 *)
PROG
(Python)
from sympy import divisors
def aupton(terms):
alst, aset, minunused = [1, 2], {1, 2}, 3
while len(alst) < terms:
concat = int(str(alst[-2])+str(alst[-1]))
k = minunused
while k in aset or concat%int(str(k)[0]): k += 1
an = k; alst.append(an); aset.add(an)
while minunused in aset: minunused += 1
return alst
print(aupton(72)) # Michael S. Branicky, Feb 20 2022
CROSSREFS
Cf. A085946.
Sequence in context: A119023 A213962 A216937 * A230625 A048985 A337183
KEYWORD
base,nonn
AUTHOR
Eric Angelini and Carole Dubois, Feb 20 2022
STATUS
approved