

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.


4




OFFSET

1,2


COMMENTS

As with A332580 a heuristic argument, based on the divergent sum of reciprocals which approximates the probability that the concatenation of 1,2,...,n will divide the concatenation of n+1,n+2,...,n+k suggests that k should always exist. However an examination of the prime factors of the concatenation of 1,2,...,n shows that most of these numbers contain one or more very large primes, suggesting the values of k will likely become extremely large as n increases.
The author thanks Joseph Myers for suggestions for finding the larger terms of this sequence.


LINKS



EXAMPLE

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.


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; in
end:


PROG

(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)
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


CROSSREFS



KEYWORD

nonn,base,more,hard


AUTHOR



STATUS

approved



