login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Lexicographically earliest sequence of distinct positive integers such that the sum of digits of any consecutive pair of terms divides their consecutive concatenation.
0

%I #17 Jul 07 2020 06:13:38

%S 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,

%T 32,31,41,48,24,45,50,44,25,34,35,28,56,52,38,42,60,62,9,54,39,27,55,

%U 65,17,29,70,33,66,47,46,80

%N Lexicographically earliest sequence of distinct positive integers such that the sum of digits of any consecutive pair of terms divides their consecutive concatenation.

%C Conjecture: This is a permutation of the natural numbers. The concatenation of any pair of adjacent terms is a composite number.

%e 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...

%t 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 *)

%o (Python)

%o def sumdigits(n):

%o return sum(int(i) for i in list(str(n)))

%o def concat(a,b):

%o return int(str(a)+str(b))

%o def addterm(l):

%o n,i=l[-1],1

%o while True:

%o c=concat(n,i)

%o if c % sumdigits(c)==0 and i not in l:

%o return l+[i]

%o i+=1

%o def seq(n):

%o sequence=[1]

%o while len(sequence)<n:

%o sequence=addterm(sequence)

%o return sequence # David Nacin, May 31 2020

%Y Cf. A005349.

%K nonn,base

%O 1,2

%A _David James Sycamore_, May 31 2020