OFFSET
1,1
COMMENTS
a(n) ~ n^2. For n > 468, the formula .358*n^2.085 provides an estimate of a(n) accurate to within 11%.
a(10) = 57 is the first term that meets the criterion in two ways (5^2 + 2^5 and 7^2 + 2^3). In the first 10000 terms, there are 30 terms expressible in two ways, but none expressible in three ways.
LINKS
Christian N. K. Anderson, Table of n, a(n) for n = 1..10000
Christian N. K. Anderson, Ulam Spiral of a(n) for n = 1..10000.
Christian N. K. Anderson, Table of n, a(n), and all values of (p,q) producing a(n) for n = 1..10000.
EXAMPLE
29 = 5^2 + 2^2, and both 5 and 2 are prime.
MATHEMATICA
nn = 15; ps = Prime[Range[nn]]; p2 = Prime[Range[PrimePi[2*Log[2, ps[[-1]]]]]]; t = Table[p^2 + 2^q, {p, ps}, {q, p2}]; Union[Select[Flatten[t], # < ps[[-1]]^2 &]] (* T. D. Noe, May 15 2013 *)
PROG
(R) library(gmp); x=y=as.bigz(2); maxval=10000; sol=as.bigz(matrix(0, nc=3, nr=1000)); len=0
while(len<1000 & x^2+2^y<maxval) {
while(len<1000 & (k=x^2+2^y)<maxval) {
sol[(len=len+1), ]=c(k, x, y)
y=nextprime(y)
}
x=nextprime(x); y=2
}
sol=sol[1:len, ]; sort(unique(as.numeric(sol[, 1])))
CROSSREFS
KEYWORD
nonn
AUTHOR
Kevin L. Schwartz and Christian N. K. Anderson, May 09 2013
STATUS
approved