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 #12 Sep 08 2022 08:45:32
%S 3,2,2,4,30,6,6,4,30,2,12,18,6,24,14,14,12,10,16,2,6,4,2,14,54,6,4,18,
%T 4,2,30,26,56,10,24,12,24,10,30,2,18,6,26,24,14,28,18,10,14,10,12,24,
%U 16,6,18,2,20,6,4,12,4,6,10,2,6,14,16,4,18,10,14,14,16,24,4,12,32,16,50,12,2
%N Smallest k such that p(n)^3 + k is prime where p(n) is the n-th prime.
%H Bruno Berselli, <a href="/A133518/b133518.txt">Table of n, a(n) for n = 1..1000</a>
%e p(1)=2, 2^3 = 8. for even k, 2^r + k is even and thus not prime, so we only need consider odd k.
%e for k = 1: 8 + 1 = 9, which is 3^2 and not prime.
%e for k = 3: 8 + 3 = 11, which is prime, so 3 is the smallest number that can be added to 8 to make a new prime.
%e Hence a(1) = 3.
%t Table[NextPrime[Prime[n]^3] - Prime[n]^3, {n, 100}] (* _Bruno Berselli_, Sep 03 2013 *)
%o (PARI) a(n) = {k = 0; p3 = prime(n)^3; while (! isprime(p3+k), k++); k;} \\ _Michel Marcus_, Sep 03 2013
%o (PARI) a(n) = {p3 = prime(n)^3; nextprime(p3) - p3;} \\ _Michel Marcus_, Sep 03 2013
%o (Magma) [NextPrime(p^3)-p^3: p in PrimesUpTo(500)]; // _Bruno Berselli_, Sep 03 2013
%Y Cf. A030078, A054271, A091666, A133517, A133519, A133520, A133521, A133522, (A001223).
%K nonn,easy
%O 1,1
%A _Carl R. White_, Sep 14 2007