A332867 a(n) = minimal positive k such that the concatenation of decimal digits 1,2,...,n is a divisor of the concatenation of n+1,n+2,...,n+k.
1, 4, 20, 1834, 14995, 6986, 2888370, 795412, 37366487, 8803255100
Offset: 1
Examples
a(2) = 4 as '1'||'2' = 12 and '3'||'4'||'5'||'6' = 3456, which is divisible by 12 (where '||' denotes decimal concatenation). a(3) = 20 as '1'||'2'||'3' = 123 and '4'||'5'||...||'22'||'23' = 4567891011121314151617181920212223, which is divisible by 123.
Links
- J. S. Myers, R. Schroeppel, S. R. Shannon, N. J. A. Sloane, and P. Zimmermann, Three Cousins of Recaman's Sequence, arXiv:2004:14000 [math.NT], April 2020.
Programs
-
Maple
a:= proc(n) local i, t, m; t, m:= parse(cat($1..n)), 0; for i from n+1 do m:= parse(cat(m,i)) mod t; if m=0 then break fi od; i-n end: seq(a(n), n=1..6); # Alois P. Heinz, Feb 29 2020
-
PARI
a(n) = {my(k=1, small="", big = n+1); for (j=1, n, small=concat(small, Str(j))); small = eval(small); while (big % small, k++; big = eval(concat(Str(big), Str(n+k)))); k;} \\ Michel Marcus, Feb 29 2020
-
Python
def A332867(n): m, k = int(''.join(str(d) for d in range(1,n+1))), 1 i = n+k i2, l = i % m, len(str(i)) t = 10**l t2, r = t % m, i % m while r != 0: k += 1 i += 1 i2 = (i2+1) % m if i >= t: l += 1 t *= 10 t2 = (10*t2) % m r = (r*t2 + i2) % m return k # Chai Wah Wu, May 20 2020
Comments