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.

This page as a plain text file.
%I A248831 #35 May 22 2025 10:21:40
%S A248831 1,4,1,6,309,6,8078,1875,69480,66,7,32,8462,388,87,2764,27350,846,12,
%T A248831 24,6055850,4,999358,41322266,27505,9995050,527820605,470,5,716059,
%U A248831 453459686,285,86408,5,87,4508,627995,8968,396546,808,640620,5,50,502,599,2
%N A248831 Prime sieve of the square root of 2.
%C A248831 Algorithm: see A245770 (prime sieve of Pi).
%H A248831 Manfred Scheucher, <a href="/A248831/b248831.txt">Table of n, a(n) for n = 1..431</a>
%H A248831 Wikipedia, <a href="http://en.wikipedia.org/wiki/Square_root_of_2">Square root of 2</a>
%H A248831 Manfred Scheucher, <a href="/A248831/a248831_2.sage.txt">Sage Script</a> (Note: should also run in pure python with a few modifications)
%o A248831 (Python)
%o A248831 def sqroot(a, digits):
%o A248831     a = a * (10**(2*digits))
%o A248831     x_prev = 0
%o A248831     x_next = 1 * (10**digits)
%o A248831     while x_prev != x_next:
%o A248831         x_prev = x_next
%o A248831         x_next = (x_prev + (a // x_prev)) >> 1
%o A248831     return x_next
%o A248831 def primes(n):
%o A248831     sieve = [True] * n
%o A248831     for i in range(3,int(n**0.5)+1,2):
%o A248831         if sieve[i]:
%o A248831             sieve[i*i::2*i]=[False]*((n-i*i-1)/(2*i)+1)
%o A248831     return [2] + [i for i in range(3,n,2) if sieve[i]]
%o A248831 a = sqroot(2,300)#300 digits is arbitrary - lengthen for more digits
%o A248831 b = primes(10000000)#make sure to scan primes up to longest term in sequence
%o A248831 y = str(a)
%o A248831 for x in b:
%o A248831     if str(x) in y:
%o A248831         y = y.replace(str(x)," ",1)#replace first occurrence only
%o A248831 while "  " in y:
%o A248831     y = y.replace("  "," ")#replace chains of spaces with a single space
%o A248831 z = y.split(" ")#split terms into a list
%o A248831 z = filter(None, z)#remove null terms
%o A248831 f = map(int,z)#convert to integers
%o A248831 print(f)
%o A248831 # _David Consiglio, Jr._, Jan 03 2015
%Y A248831 Cf. A002193 (square root of 2), A245770 (prime sieve of Pi), A248804 (prime sieve of e).
%K A248831 nonn,base
%O A248831 1,2
%A A248831 _Jared Kish_, Oct 15 2014
%E A248831 More terms from _David Consiglio, Jr._, Dec 02 2014, Jan 03 2015
%E A248831 More terms from _Manfred Scheucher_, May 25 2015