login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A356880
Squares that can be expressed as the sum of two powers of two (2^x + 2^y).
3
4, 9, 16, 36, 64, 144, 256, 576, 1024, 2304, 4096, 9216, 16384, 36864, 65536, 147456, 262144, 589824, 1048576, 2359296, 4194304, 9437184, 16777216, 37748736, 67108864, 150994944, 268435456, 603979776, 1073741824, 2415919104, 4294967296, 9663676416, 17179869184
OFFSET
1,1
COMMENTS
If x is even, y = x + 3; if x is odd, y = x.
Proof for odd x: (2^odd + 2^odd) = 2^(odd + 1) = 2^even --> must be a square.
Proof for even x: 2^even + 2^(even + 3) = 1*(2^even) + (2^even * 2^3) = 1*(2^even) + (2^even * 8) = 1*(2^even) + 8*(2^even) = 9*(2^even); since 9 is a square and 2^even is a square, the multiplication result must be a square too.
And 9 is the only square that can be written as 1 + a power of 2.
Note that a(n) = A272711(n+1) for n=1..23, but beyond it differs more and more.
FORMULA
a(n) = A029744(n+1)^2.
a(n) = 9 * 2^(n-2) if n is even (see A002063).
a(n) = 2^(n+1) if n is odd (see A000302).
From Stefano Spezia, Sep 09 2022: (Start)
G.f.: x*(4 + 9*x)/(1 - 4*x^2).
E.g.f.: (9*(cosh(2*x) - 1) + 8*sinh(2*x))/4. (End)
EXAMPLE
2^4 + 2^7 = 144, a square, thus 144 is a term.
MAPLE
seq(`if`(n::even, 9*2^(n-2), 2^(n+1)), n=1..50); # Robert Israel, Sep 15 2022
MATHEMATICA
Select[Range[2, 2^17]^2, DigitCount[#, 2, 1] <= 2 &] (* Amiram Eldar, Sep 03 2022 *)
PROG
(Python)
def A356880(n):
if n % 2 == 0: return 9*2**(n-2)
else: return 2**(n+1)
(PARI) a(n) = if (n%2, 2^(n+1), 9*2^(n-2)); \\ Michel Marcus, Sep 15 2022
CROSSREFS
Intersection of A000290 and A048645\{1}.
Cf. A272711, A270473 (squares that can be expressed as 3^x + 3^y).
Cf. A220221.
Sequence in context: A226076 A357753 A272711 * A018228 A204503 A138858
KEYWORD
nonn,easy
AUTHOR
Karl-Heinz Hofmann, Sep 02 2022
STATUS
approved