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.

Showing 1-5 of 5 results.

A245770 Prime sieve of Pi.

Original entry on oeis.org

1, 9, 6, 5, 93, 84626, 3, 2, 502884, 69399, 5105820, 4944, 2, 816406286, 986, 4825342, 70, 9, 480865, 2, 66, 93, 55058, 25, 4081284, 174, 270, 85, 555964462, 4895, 9644288, 7566, 344, 28475648, 8, 65, 201, 45648, 23, 4543, 393, 2602, 412, 724, 660, 55, 74881, 20962, 25, 1715364, 892, 600
Offset: 1

Views

Author

Gil Broussard, Aug 01 2014

Keywords

Examples

			Find the first occurrence of prime 2 in the digits of Pi (only 25 digits in this illustration):
3141592653589793238462643..., and replace it with a space:
314159 653589793238462643...  Repeat the process with 3:
14159 653589793238462643...  Then 5:
141 9 653589793238462643...  Then 7:
141 9 653589 93238462643...  Then 11, 13, 17, etc., until the first occurrence of every prime is eliminated from the digits of Pi.
1   9 6  5   93  84626  ...  Then consolidate gaps between the remaining digits into a single comma:
1,9,6,5,93,84626,...         to produce the first terms in the prime sieve of Pi.
		

Crossrefs

Cf. A000796, A246022, A248804 (Prime sieve of e), A248831 (Prime sieve of sqrt(2)).

Programs

  • 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(370)
    b = primes(100000000)
    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])
    # David Consiglio, Jr., Jan 03 2015

Extensions

a(14) corrected by Manfred Scheucher, May 25 2015

A248831 Prime sieve of the square root of 2.

Original entry on oeis.org

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

Views

Author

Jared Kish, Oct 15 2014

Keywords

Comments

Algorithm: see A245770 (prime sieve of Pi).

Crossrefs

Cf. A002193 (square root of 2), A245770 (prime sieve of Pi), A248804 (prime sieve of e).

Programs

  • 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

Extensions

More terms from David Consiglio, Jr., Dec 02 2014, Jan 03 2015
More terms from Manfred Scheucher, May 25 2015

A257835 Whole number sieve of e.

Original entry on oeis.org

28, 2, 2, 5, 6, 9, 24, 9, 9, 57, 9, 6, 6, 3, 5, 2, 6, 27, 6, 3, 0, 99, 7, 35, 6, 0, 0, 59, 30, 28, 4, 6, 33, 75, 25, 4, 0, 40, 7, 6, 8, 4, 5, 4, 7, 5, 5, 70, 0, 4, 75, 49, 2, 3, 9, 7, 3, 4, 15, 6, 25, 9, 44, 5, 0, 4, 6, 6, 9, 3, 2, 99, 35, 2, 33, 5, 69, 8, 62, 30, 8
Offset: 1

Views

Author

Manfred Scheucher, Jun 05 2015

Keywords

Comments

Find the first occurrence of 0 (the first whole number) in the digits of e (only 35 digits in this illustration):
27182818284590452353602874713526625..., and replace it with a space:
2718281828459 452353602874713526625... Repeat the process with the next whole number, 1:
27 8281828459 452353602874713526625... Then 2:
7 8281828459 452353602874713526625... Then 3:
7 8281828459 452 53602874713526625... Then 4,5,6,7, etc., until the first occurrence of every counting number is eliminated from the digits of e.
28 2 02 5 6 ... Then consolidate gaps between the remaining digits into a single comma:
28,2,2,5,6,9,24,9,9,57,9,6,6,3,5,2,... to produce the first terms in the whole number sieve of e.

Crossrefs

A246022 Prime sieve of Champernowne constant A033307.

Original entry on oeis.org

1, 4, 6, 10, 12, 1, 516, 18, 202122, 242, 28, 30, 3, 3, 6, 3, 94041, 444546, 4849, 52535455, 58, 60, 6, 646566, 686, 0, 72, 74, 78, 8, 848, 888990, 9495, 98, 0, 102, 104, 6, 108, 1, 112, 1141, 16, 201, 22, 26, 1, 29130, 3, 4, 6, 138, 1, 411, 44, 47148, 150, 531
Offset: 1

Views

Author

N. J. A. Sloane, Aug 14 2014

Keywords

Comments

Start with the decimal expansion of the Champernowne constant A033307:
12345678910111213141516171819202122232425262728293031323334353637383940\
4142434445464748495051525354555657...
Find the first occurrence of the prime 2 and replace it with a space:
1 3456789101112131415161718192021222324252627282930...
1 456789101112131415161718192021222324252627282930... Repeat the process with 3
1 4 6789101112131415161718192021222324252627282930... Then 5
1 4 6 89101112131415161718192021222324252627282930... Then 7
1 4 6 8910 12 141516 18 202122 24252627282930... Then 11, 13, 17, etc., until the first occurrence of every prime is eliminated. 89, 41, 52627, will disappear.
Then consolidate gaps between the remaining digits into a single comma:
1, 4, 6, 10, 12, 1, 516, 18, 202122, 242, 28, 30, 3, 3, 6, ...

Crossrefs

Suggested by A245770, A248804, A247861. Cf. A033307, A007376.

Extensions

More terms from Manfred Scheucher, Jun 05 2015

A318708 Terms resulting from application of a prime sieve to the digits of the decimal expansions of the positive integers.

Original entry on oeis.org

1, 4, 6, 8, 9, 10, 1, 1, 14, 1, 16, 1, 18, 0, 1, 4, 6, 8, 9, 0, 1, 4, 6, 8, 9, 40, 4, 4, 44, 4, 46, 4, 48, 49, 0, 1, 4, 6, 8, 9, 60, 6, 6, 64, 6, 66, 6, 68, 69, 0, 1, 4, 6, 8, 9, 80, 81, 8, 8, 84, 8, 86, 8, 88, 90, 91, 9, 9, 94, 9, 96, 9, 98, 99, 100, 10, 10, 104, 10, 106, 10, 108, 0, 1, 4
Offset: 1

Views

Author

Ctibor O. Zizka, Sep 01 2018

Keywords

Comments

Definition of sieving over the digits of k: Erase each digit 2 in the decimal expansion of k, then consolidate the remaining digits. Erase each digit 3 in what remains from the previous step, then consolidate the remaining digits. Repeat the procedure with 5, 7, ..., largest prime <= last consolidated remainder. What remains then becomes a term of the sequence. If there are no remaining digits after the procedure, this number disappears and is not a term.
Consolidation means the removal of all empty places at each step of the sieving process. Example: k = 1225; erasing all 2's in 1225 results in 1__5, which consolidates to 15; erasing all 3's in 15 results in 15; erasing all 5's in 15 results in 1_, which consolidates to 1. So for k = 1225 the result after sieving is 1. Example: k = 10101; erasing all 2's, ..., 97's results in 10101; erasing 101's in 10101 results in ___01, which consolidates to the last consolidated remainder 01. As there is no prime <= 01 to sieve with, the result for k = 10101 after sieving is 1.
Largest number of a sieve <= last consolidated remainder.
This sequence sieve is: {primes}. There could be other sieve definitions: {binary numbers}, {even numbers}, {odd numbers}, {triangular numbers}, predefined set of numbers like {0,3,11,27}, etc.

Examples

			n = 113
p_1 = 2, no occurrence of 2 in 113
p_2 = 3, 1 occurrence of 3 in 113, erase 3, remains 11
p_3 = 5, no occurrence of 5 in 11
p_4 = 7, no occurrence of 7 in 11
p_5 = 11, 1 occurrence of 11 in 11, no remainder
number 113 disappears and is not a member of the seq.
n = 114
p_1 = 2, no occurrence of 2 in 114
p_2 = 3, no occurrence of 3 in 114
p_3 = 5, no occurrence of 5 in 114
p_4 = 7, no occurrence of 7 in 114
p_5 = 11, 1 occurrence of 11 in 114, erase 11, remains 4
number 4 is a member of the seq.
		

Crossrefs

Programs

  • Mathematica
    upto[n_] := Block[{s = ToString /@ Range[n]}, Do[s = StringReplace[s, ToString[p] -> ""], {p, Prime@ Range@ PrimePi@ n}]; ToExpression@ DeleteCases[s, ""]]; upto[115] (* Giovanni Resta, Sep 01 2018 *)
Showing 1-5 of 5 results.