login
Smallest prime formed by concatenation of n consecutive cubes, 0 if no such prime exists.
1

%I #10 Feb 22 2020 02:32:20

%S 0,827,0,2744337540964913,49135832685980009261,0,

%T 16194277163870641658137516777216169745931717351217373979,

%U 64348566539203664467267512696859000696787170778887189057,0

%N Smallest prime formed by concatenation of n consecutive cubes, 0 if no such prime exists.

%C From _Robert Israel_, Feb 20 2020: (Start)

%C a(n)=0 if n is divisible by 3, as the sum of three consecutive cubes is divisible by 3.

%C a(22) has 2132 digits, too large for a b-file: it is the concatenation of 99999999999999999999999999999998^3 to 100000000000000000000000000000019^3. (End)

%H Robert Israel, <a href="/A104375/b104375.txt">Table of n, a(n) for n = 1..21</a>

%e a(2)=827 because 827 is the smallest prime formed from concatenation of 2 consecutive cubes i.e. 8 and 27.

%p ccat:= proc(L)

%p local t,i;

%p t:= L[1];

%p for i from 2 to nops(L) do

%p t:= t*10^(ilog10(L[i])+1)+L[i]

%p od;

%p t

%p end proc:

%p f:= proc(n) local k,p;

%p if n mod 3 = 0 then return 0 fi;

%p for k from floor(n/2)*2+1 by 2 do

%p p:= ccat([seq((k-i)^3,i=n-1..0,-1)]);

%p if isprime(p) then return p fi

%p od

%p end proc:

%p f(1):= 0:

%p map(f, [$1..10]); # _Robert Israel_, Feb 20 2020

%K base,nonn

%O 1,2

%A _Shyam Sunder Gupta_, Apr 17 2005