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.

A248831 Prime sieve of the square root of 2.

Original entry on oeis.org

1, 4, 1, 6, 309, 6, 8078, 1875, 69480, 66, 7, 32, 8462, 388, 87, 2764, 27350, 846, 12, 24, 6055850, 4, 999358, 41322266, 27505, 9995050, 527820605, 470, 5, 716059, 453459686, 285, 86408, 5, 87, 4508, 627995, 8968, 396546, 808, 640620, 5, 50, 502, 599, 2
Offset: 1

Views

Author

Jared Kish, Oct 15 2014

Keywords

Comments

Algorithm: see A245770 (prime sieve of Pi).

Crossrefs

Cf. A002193 (square root of 2), A245770 (prime sieve of Pi), A248804 (prime sieve of e).

Programs

  • Python
    def sqroot(a, digits):
        a = a * (10**(2*digits))
        x_prev = 0
        x_next = 1 * (10**digits)
        while x_prev != x_next:
            x_prev = x_next
            x_next = (x_prev + (a // x_prev)) >> 1
        return x_next
    def primes(n):
        sieve = [True] * n
        for i in range(3,int(n**0.5)+1,2):
            if sieve[i]:
                sieve[i*i::2*i]=[False]*((n-i*i-1)/(2*i)+1)
        return [2] + [i for i in range(3,n,2) if sieve[i]]
    a = sqroot(2,300)#300 digits is arbitrary - lengthen for more digits
    b = primes(10000000)#make sure to scan primes up to longest term in sequence
    y = str(a)
    for x in b:
        if str(x) in y:
            y = y.replace(str(x)," ",1)#replace first occurrence only
    while "  " in y:
        y = y.replace("  "," ")#replace chains of spaces with a single space
    z = y.split(" ")#split terms into a list
    z = filter(None, z)#remove null terms
    f = map(int,z)#convert to integers
    print(f)
    # David Consiglio, Jr., Jan 03 2015

Extensions

More terms from David Consiglio, Jr., Dec 02 2014, Jan 03 2015
More terms from Manfred Scheucher, May 25 2015