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.

A383502 Position of the first instance of prime(n), in base 3, in the ternary representation of Pi after the ternary point.

Original entry on oeis.org

2, 4, 6, 2, 12, 20, 6, 10, 27, 16, 85, 3, 35, 78, 95, 6, 38, 96, 19, 27, 9, 66, 157, 171, 81, 191, 12, 127, 52, 3, 36, 275, 88, 589, 283, 40, 290, 952, 47, 10, 1213, 750, 572, 84, 126, 2, 282, 162, 125, 480, 26, 66, 185, 157, 1490, 1310, 832, 1321, 352
Offset: 1

Views

Author

James S. DeArmon, Apr 28 2025

Keywords

Comments

Positions are numbered starting from 1 for the first ternary digit after the ternary point in Pi.

Examples

			The ternary digits of Pi and their numbering, after the ternary point, begin
          1 2 3 4 5 6 7 8 9 ...
   0 1  . 0 2 1 1 0 1 2 2 2 2 0 1 0 2 ...
                    \---/
prime(7) is 17, or 122_3, which first appears at position 6.
		

Crossrefs

Programs

  • Python
    import gmpy2
    from sympy import isprime
    def to_base3(n):
        if n == 0: return '0'
        d = []
        while n: d.append(str(n % 3)); n //= 3
        return ''.join(reversed(d))
    gmpy2.get_context().precision = 1200000
    pi_ternary = gmpy2.digits(gmpy2.const_pi(),3)[0][4:]  # skip "10."
    out = []
    for p in range(2, 280):
        if isprime(p):
            pos = pi_ternary.find(to_base3(p)) + 1
            out.append(pos)
    print(out)