

A316935


a(n)=1; for n > 1, a(n) is the smallest number > n such that the concatenation of all terms from a(1) through a(n) is divisible by the concatenation of the integers 1 through n.


1



1, 20, 54, 946, 8180, 93504, 878732, 6841732, 102829509, 19305995230, 1822646098871, 35208071275344, 8691465582891615, 2131922062844429082, 190058192685217102545, 9285111636083665154512, 565278857209893562444229, 49237824030642874847017458, 15301141018410914663693576388
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,2


LINKS

David A. Corneth, Table of n, a(n) for n = 1..369


EXAMPLE

Let I(n) be the concatenation of the integers 1 through n, and let T(n) be the concatenation of all terms from a(1) through a(n). Then a(n) is the least number which, when appended to T(n1)  with leading zeros disallowed  forms a number T(n) that is strictly greater than I(n) and is a multiple of I(n).
a(1)=1, so T(1)=1. I(2)=12, so a(2)=20 because a(2) is the least number which, when appended to T(1), creates a number T(2) that is greater than I(2)=12 and evenly divisible by it, and the least number greater than 12 that begins with a 1 and is divisible by 12 is 120.
a(2) is not 08 because leading zeros are not allowed.
a(3)=54 because at a(3), I(3)=123, and T(2)=120, which means that T(3) must be 12054, since the least number greater than 123 that is divisible by it but has leading digits 120 is 12054.
From David A. Corneth, Dec 18 2018: (Start)
Let concat(v) be the concatenation of the elements of vector v. To find a(n) for n >= 3, we find the concatenation of the first n1 terms. For n = 3, that's 120. We also find the concatenation of the first n positive integers, in this case, 123.
Concatenating 1 gives 1201. 1201 mod 123 = 94 < 123  8 so concatenating a 1digit number without leading zeros doesn't work.
We carry on and compute 12010 mod 123 = 79 >= 123  89 so concatenating a 2digit number without leading zeros works and we stop to find a(3) = 10 + 123  79 = 54. (End)


MATHEMATICA

getRes[m_, k_, e_] := Module[{}, r = kMod[m*10^e, k]; If[r < 10^e && m*10^e+r != k, r += k*(1 + Floor[(10^(e  1)  r)/k]); If[r>10^e, r=1], r=1]; r]; f[m_, k_] := Module[{e=1}, While[(r=getRes[m, k, e])<0, e++]; r]; t[n_] := FromDigits[ Flatten[IntegerDigits[ Range[n]]]]; a[1]=1; a[n_] := a[n] = f[FromDigits[ Flatten[IntegerDigits[Array[a, n1]]]], t[n]]; Array[a, 20] (* Amiram Eldar, Dec 13 2018 *)


PROG

(PARI) first(n) = {my(res = [1, 20]); for(i = 3, n, res = concat(res, [nxt(i, res)])); res}
nxt(n, v) = {my(div = concatnums([1..n]), start = concatnums(v)); start = 10*start+1; f = 1; subt = 8; c = start % div; while(c < div  subt, start *= 10; f*=10; subt = 10*subt + 9; c = start % div); f + div  c}
concatnums(v) = {my(res = v[1]); for(i = 2, #v, res *= 10^#Str(v[i]); res += v[i]); res} \\ David A. Corneth, Dec 18 2018


CROSSREFS

Cf. A007908 (concatenation of the numbers from 1 to n).
Sequence in context: A059677 A301372 A108108 * A123456 A144521 A044122
Adjacent sequences: A316932 A316933 A316934 * A316936 A316937 A316938


KEYWORD

nonn,easy,base,nice


AUTHOR

Christopher Hohl, Dec 12 2018


EXTENSIONS

a(8)a(18) from Jon E. Schoenfield, Dec 13 2018
a(19) from David A. Corneth, Dec 18 2018


STATUS

approved



