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.

A188915 Union of squares and powers of 2.

Original entry on oeis.org

0, 1, 2, 4, 8, 9, 16, 25, 32, 36, 49, 64, 81, 100, 121, 128, 144, 169, 196, 225, 256, 289, 324, 361, 400, 441, 484, 512, 529, 576, 625, 676, 729, 784, 841, 900, 961, 1024, 1089, 1156, 1225, 1296, 1369, 1444, 1521, 1600, 1681, 1764, 1849, 1936, 2025, 2048, 2116, 2209, 2304, 2401, 2500, 2601, 2704, 2809, 2916
Offset: 0

Views

Author

Reinhard Zumkeller, Apr 14 2011

Keywords

Comments

A188916 and A188917 give positions where squares and powers of 2 occur:
n^2: a(A188916(n)) = A000290(n);
2^n: a(A188917(n)) = A000079(n);
4^n: a(A006127(n)) = A000302(n), A006127 is the intersection of A188916 and A188917.

Crossrefs

Union of A000290 and A000079.
Disjoint union of A000290 and A004171.

Programs

  • Haskell
    import Data.List.Ordered (union)
    a188915 n = a188915_list !! n
    a188915_list = union a000290_list a000079_list
    -- Reinhard Zumkeller, May 19 2015, Apr 14 2011
    
  • Mathematica
    seq[lim_] := Union[2^Range[1, Floor[Log2[lim]], 2], Range[0, Floor[Sqrt[lim]]]^2]; seq[3000] (* Amiram Eldar, Apr 13 2025 *)
  • Python
    from math import isqrt
    def A188915(n):
        def bisection(f,kmin=0,kmax=1):
            while f(kmax) > kmax: kmax <<= 1
            while kmax-kmin > 1:
                kmid = kmax+kmin>>1
                if f(kmid) <= kmid:
                    kmax = kmid
                else:
                    kmin = kmid
            return kmax
        def f(x): return n+x-isqrt(x)-((m:=x.bit_length()-1)>>1)-(m&1)
        return bisection(f,n-1,n**2) # Chai Wah Wu, Sep 19 2024

Formula

A010052(a(n)) + A209229(a(n)) > 0. - Reinhard Zumkeller, May 19 2015
Sum_{n>=1} 1/a(n) = Pi^2/6 + 2/3. - Amiram Eldar, Apr 13 2025