login
A056007
Difference between 2^n and largest square strictly less than 2^n.
3
1, 1, 3, 4, 7, 7, 15, 7, 31, 28, 63, 23, 127, 92, 255, 7, 511, 28, 1023, 112, 2047, 448, 4095, 1792, 8191, 7168, 16383, 5503, 32767, 22012, 65535, 88048, 131071, 166831, 262143, 296599, 524287, 444943, 1048575, 296863, 2097151, 1187452, 4194303
OFFSET
0,3
COMMENTS
Note that this is not a strictly ascending sequence. - Alonso del Arte, Apr 28 2022
FORMULA
a(n) = 2^n - (ceiling(2^(n/2)) - 1)^2 = A000079(n) - (A017912(n) - 1)^2. - Vladeta Jovovic, May 01 2003
a(n) = A071797(A000079(n)). - Michel Marcus, Apr 29 2022
a(n) = 2^n - A357754(n). - Kevin Ryde, Oct 12 2022
EXAMPLE
a(5) = 2^5 - 5^2 = 7;
a(6) = 2^6 - 7^2 = 15.
MATHEMATICA
Table[2^n - Floor[Sqrt[2^n - Boole[EvenQ[n]]]]^2, {n, 0, 47}] (* Alonso del Arte, Apr 28 2022 *)
PROG
(Python)
from math import isqrt
def a(n): return 2**n - isqrt(2**n-1)**2
print([a(n) for n in range(43)]) # Michael S. Branicky, Apr 29 2022
(PARI) a(n) = if(n%2, sqrtint(1<<n, &n); n, bitneg(0, n/2+1)); \\ Kevin Ryde, Oct 12 2022
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Henry Bottomley, Jul 24 2000
STATUS
approved