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.

A249875 Numbers that are exactly halfway between the nearest square and the nearest power of 2.

This page as a plain text file.
%I A249875 #20 Dec 27 2023 15:48:17
%S A249875 3,6,34,136,498,2082,8146,32946,131058,524232,2096928,8387712,
%T A249875 33550848,134226562,536859906,2147439624,8589943858,34359775432,
%U A249875 137439101728,549756406912,2199022661826,8796090647304,35184374452498,140737497809992,562949943786834,2251799775147336
%N A249875 Numbers that are exactly halfway between the nearest square and the nearest power of 2.
%C A249875 Numbers that are the arithmetic mean of the nearest square and the nearest power of 2 (other than that nearest square).
%H A249875 Chai Wah Wu, <a href="/A249875/b249875.txt">Table of n, a(n) for n = 1..501</a>
%e A249875 3 is a term because 2<3<4; 6 is a term because 4<6<8.
%o A249875 (Python)
%o A249875 def isqrt(a):
%o A249875     sr = 1 << (a.bit_length() >> 1)
%o A249875     while a < sr * sr:
%o A249875         sr >>= 1
%o A249875     b = sr >> 1
%o A249875     while b:
%o A249875         s = sr + b
%o A249875         if a >= s * s:
%o A249875             sr = s
%o A249875         b >>= 1
%o A249875     return sr
%o A249875 for j in range(99):
%o A249875     i = 2**j
%o A249875     r = isqrt(i)
%o A249875     if r * r == i:
%o A249875         continue
%o A249875     if r & 1:
%o A249875         a = ((r + 1) * (r + 1) + i) // 2
%o A249875     else:
%o A249875         a = (i + r * r) // 2
%o A249875     print(a, end=', ')
%o A249875 (Python)
%o A249875 from gmpy2 import isqrt
%o A249875 A249875_list, x = [], 1
%o A249875 for _ in range(10**3):
%o A249875     A249875_list.append(2*sum(divmod(isqrt(2*x),2))**2+x)
%o A249875     x *= 4 # _Chai Wah Wu_, Dec 16 2014
%Y A249875 Cf. A000290, A000079, A233074, A233075.
%K A249875 nonn
%O A249875 1,1
%A A249875 _Alex Ratushnyak_, Nov 07 2014