login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A249875 Numbers that are exactly halfway between the nearest square and the nearest power of 2. 1
3, 6, 34, 136, 498, 2082, 8146, 32946, 131058, 524232, 2096928, 8387712, 33550848, 134226562, 536859906, 2147439624, 8589943858, 34359775432, 137439101728, 549756406912, 2199022661826, 8796090647304, 35184374452498, 140737497809992, 562949943786834, 2251799775147336 (list; graph; refs; listen; history; text; internal format)
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 2)

def isqrt(a):

    sr = 1L << (long.bit_length(long(a)) >> 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 str(a)+', ',

(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

Cf. A000290, A000079, A233074, A233075.

Sequence in context: A261885 A186750 A203715 * A308557 A134748 A068904

Adjacent sequences:  A249872 A249873 A249874 * A249876 A249877 A249878

KEYWORD

nonn

AUTHOR

Alex Ratushnyak, Nov 07 2014

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified October 3 22:17 EDT 2022. Contains 357237 sequences. (Running on oeis4.)