%I #27 Jun 02 2014 01:41:49
%S 1,1,2,1,6,1,4,3,10,1,6,1,4,165,2,1,252,1,210,3,16,1,6,35,4,15,2,1,
%T 2040,1,6,69,8,75,12,1,4,393,50,1,660,1,18,135,14,1,42,5,220,3,16,1,
%U 30,365,4,51,2,1,420,1,426,21,8,0,6,1,70,351,1340,1,30,1,28,525,98,61
%N a(n) = smallest number k such that n+k, n+k^2 and n+k^4 are all prime, or 0 if no such k exists.
%C a(n) = 0 is definite. a(n) = 0 iff n = 4m^4 for m > 1. If n = 4m^4, 4m^4+k^4 = (2m^2+2mk+k^2)*(2m^2-2mk+k^2), meaning it is never prime. For m = 1, 2*1^2-2*1*k+k^2 = 2-2k+k^2 is 1 for k = 1. This is why a(4) = 1.
%C If n is in A006093 (a prime minus 1), then a(n) = 1 and the 3 primes of the definition coincide. - _Michel Marcus_, Jun 01 2014
%H Robert G. Wilson v, <a href="/A243146/b243146.txt">Table of n, a(n) for n = 1..1000</a>
%e 3+1, 3+1^2, and 3+1^3 are not prime. 3+2 (5), 3+2^2 (9), and 3+2^3 (11) are all prime. Thus a(3) = 2.
%t f[n_] := If[n == 4 || !IntegerQ[(n/4)^(1/4)], Block[{k = 1}, While[ !PrimeQ[n + k] || !PrimeQ[n + k^2] || !PrimeQ[n + k^4], k++]; k], 0]; Array[ f, 70] (* _Robert G. Wilson v_, Jun 01 2014 *)
%o (PARI) a(n)=for(k=1,10^6,if(ispseudoprime(n+k)&&ispseudoprime(n+k^2)&&ispseudoprime(n+k^4),return(k)))
%o n=1;while(n<100,print1(a(n),", ");n+=1)
%K nonn
%O 1,3
%A _Derek Orr_, May 30 2014
%E Definition corrected by _N. J. A. Sloane_, May 31 2014