OFFSET
1,1
COMMENTS
Numbers that are the arithmetic mean of the nearest square and the nearest power of 2 (other than that nearest square).
LINKS
Chai Wah Wu, Table of n, a(n) for n = 1..501
EXAMPLE
3 is a term because 2<3<4; 6 is a term because 4<6<8.
PROG
(Python)
def isqrt(a):
sr = 1 << (a.bit_length() >> 1)
while a < sr * sr:
sr >>= 1
b = sr >> 1
while b:
s = sr + b
if a >= s * s:
sr = s
b >>= 1
return sr
for j in range(99):
i = 2**j
r = isqrt(i)
if r * r == i:
continue
if r & 1:
a = ((r + 1) * (r + 1) + i) // 2
else:
a = (i + r * r) // 2
print(a, end=', ')
(Python)
from gmpy2 import isqrt
A249875_list, x = [], 1
for _ in range(10**3):
A249875_list.append(2*sum(divmod(isqrt(2*x), 2))**2+x)
x *= 4 # Chai Wah Wu, Dec 16 2014
CROSSREFS
KEYWORD
nonn
AUTHOR
Alex Ratushnyak, Nov 07 2014
STATUS
approved