%I #35 Mar 12 2016 22:13:02
%S 2,11,229,2423,96137,18428720883408311299,3766153,710506473307,
%T 811194664531,727558628667293,38668911739295406763,
%U 421234704182790394882765188961074953258843496042280934188664487937,148793213122133119638187,77940588209695579136235195958919
%N Consider the concatenation of n consecutive integers S, S+1, S+2, ..., S+n-1, written in base 2 and then converted to base 10; a(n) gives (in base 10) the first prime reached for any value of S, or -1 if a prime is never reached.
%H Paolo P. Lava, <a href="/A269710/a269710.txt">List of n, prime and starting number for 1 <= n <= 100</a> [The entries -1 are probably wrong: for n <= 100, no value has been reached for n = 36, 42 and 63, testing S up to 10^6.]
%e a(1) = 2, the first prime;
%e a(2) = 11 because 2 and 3 in base 2 are 10 and 11 and their concatenation is 1011 which is 11 in base 10;
%e a(5) = 96137 because 5, 6, 7, 8, 9 written in base 2 and concatenated give 10111011110001001 which is the prime 96137 in base 10.
%e a(6) = 18428720883408311299 because 1022, 1023, 1024, 1025, 1026 and 1027 written in base 2 and concatenated give 1111111110111111111110000000000100000000011000000001010000000011 which is the prime 18428720883408311299 in base 10.
%p with(numtheory): P:= proc(q) local a,b,c,k,j,n; print(2);
%p for k from 2 to q do if k mod 2=0 then c:=2 else c:=1; fi;
%p for n from c by 2 to q do a:=convert(n,binary); b:=convert(n+1,binary);
%p for j from 1 to k-1 do b:=convert(n+j,binary); a:=a*10^(ilog10(b)+1)+b; od; a:=convert(a,decimal,binary); if isprime(a) then print(a); break; fi; od; od; end: P(10^6);
%Y Cf. A000040.
%K nonn,base
%O 1,1
%A _Paolo P. Lava_, Mar 10 2016
|