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