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”).

A247747
Whole number sieve of Pi.
5
1, 5, 9, 8, 4, 7, 9, 9, 5, 2, 16, 20, 62, 8, 3, 9, 28, 9, 44, 95, 58, 3, 2, 5, 8, 8, 7, 28, 0, 10, 59, 9, 7, 4, 78, 6, 6, 60, 6, 54, 66, 9, 0, 60, 9, 2, 7, 0, 1, 88, 0, 96, 9, 0, 6, 6, 0, 0, 305, 6, 4, 9, 9, 94, 270, 7, 9, 2, 6, 93, 1, 3, 5, 7, 6, 9, 35, 57, 9, 8, 0
OFFSET
1,2
LINKS
Manfred Scheucher, Sage Script
EXAMPLE
Find the first occurrence of 0 (the first whole number) in the digits of Pi (only 35 digits in this illustration):
31415926535897932384626433832795028..., and replace it with a space:
31415926535897932384626433832795 28... Repeat the process with the next whole number, 1:
3 415926535897932384626433832795 28... Then 2:
3 4159 6535897932384626433832795 28... Then 3:
4159 6535897932384626433832795 28... Then 4,5,6,7, etc., until the first occurrence of every counting number is eliminated from the digits of Pi.
1 5 9 8 4 ... Then consolidate gaps between the remaining digits into a single comma:
1,5,9,8,4,7,9,9,5,2,16,20,6,8,3,9, ... to produce the first terms in the whole number sieve of Pi.
PROG
(Python)
def arccot(x, unity):
sum = xpower = unity // x
n = 3
sign = -1
while 1:
xpower = xpower // (x*x)
term = xpower // n
if not term:
break
sum += sign * term
sign = -sign
n += 2
return sum
def pi(digits):
unity = 10**(digits + 10)
pi = 4 * (4*arccot(5, unity) - arccot(239, unity))
return pi // 10**10
def primes(n):
""" Returns a list of 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 = pi(400)
b = range(100000)
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 long 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[0:-1])
# Code for A245770 by David Consiglio, Jr., Jan 03 2015
# Modified by Manfred Scheucher, Jun 05 2015
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Gil Broussard, Sep 23 2014
EXTENSIONS
Corrected and extended by Manfred Scheucher, Jun 05 2015
STATUS
approved