login
A335315
Lexicographically earliest sequence of distinct positive integers such that the sum of digits of any consecutive pair of terms divides their consecutive concatenation.
1
1, 2, 4, 5, 10, 8, 20, 7, 11, 16, 30, 6, 3, 12, 15, 21, 19, 26, 18, 36, 40, 14, 13, 23, 22, 32, 31, 41, 48, 24, 45, 50, 44, 25, 34, 35, 28, 56, 52, 38, 42, 60, 62, 9, 54, 39, 27, 55, 65, 17, 29, 70, 33, 66, 47, 46, 80, 64, 43, 68, 58, 59, 67, 75, 81, 72, 90, 82
OFFSET
1,2
COMMENTS
Conjecture: This is a permutation of the natural numbers. The concatenation of any pair of adjacent terms is a composite number.
LINKS
EXAMPLE
a(1) = 1 because this is the lexicographically earliest positive number. Then a(2) = 2 because 3|12. Then a(3) = 4 since 3 does not divide 23 but 6 divides 24. And so on...
MATHEMATICA
sod[n_] := Plus @@ IntegerDigits@ n; c[x_, y_] := FromDigits[Join @@ IntegerDigits@ {x, y}]; L = {1}; Do[ k=1; s = sod@ Last@ L; While[ MemberQ[L, k] || Mod[ c[ Last@ L, k], s + sod@ k] != 0, k++]; AppendTo[L, k], {60}]; L (* Giovanni Resta, May 31 2020 *)
(* second, faster program *)
Block[{c, d, j, k, q, u, nn}, nn = 120; c[_] := False; d = j = 1; q = {1}; u = 2; {1}~Join~Reap[Do[k = u; While[Set[p, IntegerDigits[k]]; Or[c[k], ! Divisible[FromDigits[Join[q, p]], d + Total[p]]], k++]; Set[{c[k], j, q, d}, {True, k, p, Total[p]}]; Sow[k]; If[k == u, While[c[u], u++]], {n, 2, nn}] ][[-1, 1]] ] (* Michael De Vlieger, Jul 01 2025 *)
PROG
(Python)
def sumdigits(n):
return sum(int(i) for i in list(str(n)))
def concat(a, b):
return int(str(a)+str(b))
def addterm(l):
n, i=l[-1], 1
while True:
c=concat(n, i)
if c % sumdigits(c)==0 and i not in l:
return l+[i]
i+=1
def seq(n):
sequence=[1]
while len(sequence)<n:
sequence=addterm(sequence)
return sequence # David Nacin, May 31 2020
CROSSREFS
Cf. A005349.
Sequence in context: A276608 A173660 A353384 * A307805 A189767 A173817
KEYWORD
nonn,base
AUTHOR
EXTENSIONS
More terms from Michael De Vlieger, Jul 01 2025
STATUS
approved