cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A056007 Difference between 2^n and largest square strictly less than 2^n.

Original entry on oeis.org

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

Views

Author

Henry Bottomley, Jul 24 2000

Keywords

Comments

Note that this is not a strictly ascending sequence. - Alonso del Arte, Apr 28 2022

Examples

			a(5) = 2^5 - 5^2 =  7;
a(6) = 2^6 - 7^2 = 15.
		

Crossrefs

Programs

  • Mathematica
    Table[2^n - Floor[Sqrt[2^n - Boole[EvenQ[n]]]]^2, {n, 0, 47}] (* Alonso del Arte, Apr 28 2022 *)
  • PARI
    a(n) = if(n%2, sqrtint(1<Kevin Ryde, Oct 12 2022
  • 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
    

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