OFFSET
1,1
COMMENTS
Does this sequence contain every prime > 113? - Robert Israel, Aug 26 2018
From David A. Corneth, Aug 26 2018: (Start)
As the primes in the sum are distinct and has four terms, exactly one of (p1, p2, p3, p4) is 2.
Contains all the primes in [120, 5 * 10^7]. (End)
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
David A. Corneth, Statistic for computations using the PARI program below
David A. Corneth, PARI program
EXAMPLE
227 belongs to this sequence as 227 = 3^4 + 5^3 + 2^2 + 17, with 2, 3, 5 and 17 all primes.
MAPLE
N:= 1000: # to get all terms <= N
V:= Vector(N):
p1:= 1:
do
p1:= nextprime(p1);
if p1^4 > N then break fi;
p2:= 1:
do
p2:= nextprime(p2);
if p1^4 + p2^3 > N then break fi;
if p2 = p1 then next fi;
p3:= 1;
do
p3:= nextprime(p3);
if p1^4 + p2^3 + p3^2 > N then break fi;
if p3 = p1 or p3 = p2 then next fi;
if min(p1, p2, p3)>2 then
p4:= 2;
x:= p1^4+p2^3+p3^2+p4;
if isprime(x) then V[x]:= 1 fi;
else
p4:= 2;
do
p4:= nextprime(p4);
if p1^4 + p2^3 + p3^2 + p4 > N then break fi;
if p4 = p1 or p4 = p2 or p4 = p3 then next fi;
x:= p1^4+p2^3+p3^2+p4;
if isprime(x) then V[x]:= 1 fi;
od
fi
od od od:
select(t -> V[t]=1, [$1..N]); # Robert Israel, Aug 26 2018
MATHEMATICA
v[t_] := Prime@Range@PrimePi@t; up = 400; Union@Reap[ Do[ If[PrimeQ[p = p1^4 + p2^3 + p3^2 + p4] && (s = {p1, p2, p3, p4}; Sort@s == Union@s), Sow@p], {p1, v[ up^(1/4)]}, {p2, v@Sqrt[up - p1^4]}, {p3, v[up - p1^4 - p2^3]}, {p4, v[up - p1^4 - p2^3 - p3^2]}]][[2, 1]] (* Giovanni Resta, Aug 19 2018 *)
PROG
(Minizinc)
include "globals.mzn";
int: n = 4;
%to get all primes less than 250 of this sequence
int: max_val = 250;
array[1..n+1] of var 2..max_val: x;
% primes between 2..max_valset of int:
prime = 2..max_val diff { i | i in 2..max_val, j in 2..ceil(sqrt(i)) where i mod j = 0} ;
set of int: primes;
primes = prime union {2};
solve satisfy;
constraint all_different(x) /\
x[1] in primes /\
x[2] in primes /\
x[3] in primes /\
x[4] in primes /\
x[5] in primes /\
pow(x[4], 4)+pow(x[3], 3)+pow(x[2], 2)+pow(x[1], 1)= x[5] ;
output [ show(x[5])]
CROSSREFS
KEYWORD
nonn
AUTHOR
Pierandrea Formusa, Aug 19 2018
EXTENSIONS
More terms from Giovanni Resta, Aug 19 2018
STATUS
approved