login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A248831
Prime sieve of the square root of 2.
5
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,2
COMMENTS
Algorithm: see A245770 (prime sieve of Pi).
LINKS
Wikipedia, Square root of 2
Manfred Scheucher, Sage Script (Note: should also run in pure python with a few modifications)
PROG
(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
CROSSREFS
Cf. A002193 (square root of 2), A245770 (prime sieve of Pi), A248804 (prime sieve of e).
Sequence in context: A364509 A349545 A291056 * A227729 A096966 A140703
KEYWORD
nonn,base
AUTHOR
Jared Kish, Oct 15 2014
EXTENSIONS
More terms from David Consiglio, Jr., Dec 02 2014, Jan 03 2015
More terms from Manfred Scheucher, May 25 2015
STATUS
approved