OFFSET
1,1
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
MAPLE
N:= 10^4: # to get all terms <= N
primepows:= {1, seq(seq(p^n, n=1..floor(log[p](N))),
p=select(isprime, [2, seq(2*k+1, k=1..(N-1)/2)]))}:
npp:= nops(primepows):
B:= Vector(N, datatype=integer[4]):
for n from 1 to npp do for m from n to npp do
j:= primepows[n]+primepows[m];
if j <= N then B[j]:= B[j]+1 fi;
od od:
select(t -> B[t] = 1, primepows); # Robert Israel, Nov 21 2014
MATHEMATICA
max = 2000; ppQ[n_] := n == 1 || PrimePowerQ[n]; pp = Select[Range[max], ppQ]; lp = Length[pp]; Table[pp[[i]] + pp[[j]], {i, 1, lp}, {j, i, lp}] // Flatten // Select[#, ppQ[#] && # <= max&]& // Sort // Split // Select[#, Length[#] == 1&]& // Flatten (* Jean-François Alcover, Mar 04 2019 *)
PROG
(Haskell)
a095841 n = a095841_list !! (n-1)
a095841_list = filter ((== 1) . a071330) a000961_list
-- Reinhard Zumkeller, Jan 11 2013
(PARI) is(n)=if(n<127, return(n==2||n==3)); isprimepower(n) && sum(i=2, n\2, isprimepower(i)&&isprimepower(n-i))==1 \\ naive; Charles R Greathouse IV, Nov 21 2014
(PARI) is(n)=if(!isprimepower(n), return(0)); my(s); forprime(p=2, n\2, if(isprimepower(n-p) && s++>1, return(0))); for(e=2, log(n)\log(2), forprime(p=2, sqrtnint(n\2, e), if(isprimepower(n-p^e) && s++>1, return(0)))); s+(!!isprimepower(n-1))==1 || n==2 \\ faster; Charles R Greathouse IV, Nov 21 2014
(PARI) has(n)=my(s); forprime(p=2, n\2, if(isprimepower(n-p) && s++>1, return(0))); for(e=2, log(n)\log(2), forprime(p=2, sqrtnint(n\2, e), if(isprimepower(n-p^e) && s++>1, return(0)))); s+(!!isprimepower(n-1))==1
list(lim)=my(v=List([2])); forprime(p=2, lim, if(has(p), listput(v, p))); for(e=2, log(lim)\log(2), forprime(p=2, lim^(1/e), if(has(p^e), listput(v, p^e)))); Set(v) \\ Charles R Greathouse IV, Nov 21 2014
CROSSREFS
KEYWORD
nonn
AUTHOR
Reinhard Zumkeller, Jun 10 2004
STATUS
approved