login
A095841
Prime powers having exactly one partition into two prime powers.
5
2, 3, 127, 163, 179, 191, 193, 223, 239, 251, 269, 311, 337, 343, 389, 419, 431, 457, 491, 547, 557, 569, 599, 613, 653, 659, 673, 683, 719, 739, 787, 821, 839, 853, 883, 911, 929, 953, 967, 977, 1117, 1123, 1201, 1229, 1249, 1283, 1289, 1297, 1303, 1327, 1381, 1409, 1423, 1439, 1451, 1471, 1481, 1499, 1607, 1663, 1681
OFFSET
1,1
COMMENTS
A095840(A095874(a(n))) = 1.
A071330(a(n)) = 1.
LINKS
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
Intersection of A208247 and A000961.
Sequence in context: A258968 A125674 A180533 * A004865 A006286 A371230
KEYWORD
nonn
AUTHOR
Reinhard Zumkeller, Jun 10 2004
STATUS
approved