Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #52 Jan 02 2024 14:45:49
%S 2,82,1888,6842,6,50,20,10,1320,28,208,32,66,148,1008,60,192,124536,
%T 282,46,128,32,28,86,40,33198,36,42,346,738,1532,246,70,68,102,306,56,
%U 20226,78316,10778,328,2432,738,2783191412956,48,746,8350,398,70,150,2300,21378
%N a(n) = minimal value of n+k (with k >= 1) such that the concatenation of the decimal digits of n,n+1,...,n+k is divisible by n+k+1, or -1 if no such n+k exists.
%C Certainly a(n) must be even, since no odd number can be divisible by an even number.
%C The values of k = a(n)-n are given in the companion sequence A332580, which also has an extended table of values.
%C A heuristic argument suggests that n+k should always exist.
%H J. S. Myers, R. Schroeppel, S. R. Shannon, N. J. A. Sloane, and P. Zimmermann, <a href="http://arxiv.org/abs/2004.14000">Three Cousins of Recaman's Sequence</a>, arXiv:2004:14000 [math.NT], April 2020.
%F a(n) = n + A332580(n) (trivially from the definitions).
%e a(1) = 2 as '1' || '2' = '12', which is divisible by 3 (where || denotes decimal concatenation).
%e a(7) = 20 as '7' || '8' || '9' || '10' || '11' || '12' || ... || '20' = 7891011121314151617181920, which is divisible by 21.
%e a(8) = 10 as '8' || '9' || '10' = 8910, which is divisible by 11.
%e a(2) = 82: the concatenation 2 || 3 || ... || 82 is
%e 23456789101112131415161718192021222324252627282930313233343536373839\
%e 40414243444546474849505152535455565758596061626364656667686970717273747\
%e 576777879808182, which is divisible by 83.
%p grow := proc(n,M) # searches out to a limit of M, returns [n,n+k] or [n,-1] if no k was found
%p local R,i;
%p R:=n;
%p for i from n+1 to M do
%p R:=R*10^length(i)+i;
%p if (i mod 2) = 0 then
%p if (R mod (i+1)) = 0 then return([n, i]); fi;
%p fi;
%p od:
%p [n, -1];
%p end;
%p for n from 1 to 100 do lprint(grow(n,20000)); od;
%o (PARI) apply( {A332584(n,L=10^#Str(n),c=n)= until((c=c*L+n)%(n+1)==0, n++<L||L*=10);n}, [1..17]) \\ _M. F. Hasler_, Feb 20 2020
%o (Python)
%o def A332584(n):
%o r, m = n, n + 1
%o while True:
%o r = r*10**(len(str(m))) + m
%o if m % 2 == 0 and r % (m+1) == 0:
%o return m
%o m += 1 # _Chai Wah Wu_, Jun 12 2020
%Y Cf. A061836 (multiplication instead of concatenation), A332580, A332585.
%K nonn,base
%O 1,1
%A _Scott R. Shannon_ and _N. J. A. Sloane_, Feb 16 2020
%E a(44) onwards (using A332580) added by _Andrew Howroyd_, Jan 02 2024