login
A188915
Union of squares and powers of 2.
5
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,3
COMMENTS
Union of A000290 and A000079;
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.
A010052(a(n)) + A209229(a(n)) > 0. - Reinhard Zumkeller, May 19 2015
LINKS
PROG
(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
(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
KEYWORD
nonn
AUTHOR
Reinhard Zumkeller, Apr 14 2011
STATUS
approved