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.

A247747 Whole number sieve of Pi.

This page as a plain text file.
%I A247747 #20 Jun 23 2025 17:08:12
%S A247747 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,
%T A247747 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,
%U A247747 6,4,9,9,94,270,7,9,2,6,93,1,3,5,7,6,9,35,57,9,8,0
%N A247747 Whole number sieve of Pi.
%H A247747 Manfred Scheucher, <a href="/A247747/b247747.txt">Table of n, a(n) for n = 1..552</a>
%H A247747 Manfred Scheucher, <a href="/A247747/a247747.sage.txt">Sage Script</a>
%e A247747 Find the first occurrence of 0 (the first whole number) in the digits of Pi (only 35 digits in this illustration):
%e A247747 31415926535897932384626433832795028..., and replace it with a space:
%e A247747 31415926535897932384626433832795 28...  Repeat the process with the next whole number, 1:
%e A247747 3 415926535897932384626433832795 28...  Then 2:
%e A247747 3 4159 6535897932384626433832795 28...  Then 3:
%e A247747   4159 6535897932384626433832795 28...  Then 4,5,6,7, etc., until the first occurrence of every counting number is eliminated from the digits of Pi.
%e A247747    1    5   9     8    4           ...  Then consolidate gaps between the remaining digits into a single comma:
%e A247747 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.
%o A247747 (Python)
%o A247747 def arccot(x, unity):
%o A247747     sum = xpower = unity // x
%o A247747     n = 3
%o A247747     sign = -1
%o A247747     while 1:
%o A247747         xpower = xpower // (x*x)
%o A247747         term = xpower // n
%o A247747         if not term:
%o A247747             break
%o A247747         sum += sign * term
%o A247747         sign = -sign
%o A247747         n += 2
%o A247747     return sum
%o A247747 def pi(digits):
%o A247747     unity = 10**(digits + 10)
%o A247747     pi = 4 * (4*arccot(5, unity) - arccot(239, unity))
%o A247747     return pi // 10**10
%o A247747 def primes(n):
%o A247747     """ Returns  a list of primes < n """
%o A247747     sieve = [True] * n
%o A247747     for i in range(3, int(n**0.5)+1, 2):
%o A247747         if sieve[i]:
%o A247747             sieve[i*i::2*i]=[False]*((n-i*i-1)/(2*i)+1)
%o A247747     return [2] + [i for i in range(3, n, 2) if sieve[i]]
%o A247747 a = pi(400)
%o A247747 b = range(100000)
%o A247747 y = str(a)
%o A247747 for x in b:
%o A247747     if str(x) in y:
%o A247747         y = y.replace(str(x), " ", 1)#replace first occurrence only
%o A247747 while "  " in y:
%o A247747     y = y.replace("  ", " ")#replace long chains of spaces with a single space
%o A247747 z = y.split(" ")#split terms into a list
%o A247747 z = filter(None, z)#remove null terms
%o A247747 f = list(map(int, z))#convert to integers
%o A247747 print(f[0:-1])
%o A247747 # Code for A245770 by David Consiglio, Jr., Jan 03 2015
%o A247747 # Modified by Manfred Scheucher,  Jun 05 2015
%Y A247747 Cf. A000796, A245770, A258640, A258481, A257835.
%K A247747 nonn,base
%O A247747 1,2
%A A247747 _Gil Broussard_, Sep 23 2014
%E A247747 Corrected and extended by _Manfred Scheucher_, Jun 05 2015