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.

This page as a plain text file.
%I A383502 #18 May 30 2025 00:49:35
%S A383502 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,
%T A383502 191,12,127,52,3,36,275,88,589,283,40,290,952,47,10,1213,750,572,84,
%U A383502 126,2,282,162,125,480,26,66,185,157,1490,1310,832,1321,352
%N A383502 Position of the first instance of prime(n), in base 3, in the ternary representation of Pi after the ternary point.
%C A383502 Positions are numbered starting from 1 for the first ternary digit after the ternary point in Pi.
%e A383502 The ternary digits of Pi and their numbering, after the ternary point, begin
%e A383502           1 2 3 4 5 6 7 8 9 ...
%e A383502    0 1  . 0 2 1 1 0 1 2 2 2 2 0 1 0 2 ...
%e A383502                     \---/
%e A383502 prime(7) is 17, or 122_3, which first appears at position 6.
%o A383502 (Python)
%o A383502 import gmpy2
%o A383502 from sympy import isprime
%o A383502 def to_base3(n):
%o A383502     if n == 0: return '0'
%o A383502     d = []
%o A383502     while n: d.append(str(n % 3)); n //= 3
%o A383502     return ''.join(reversed(d))
%o A383502 gmpy2.get_context().precision = 1200000
%o A383502 pi_ternary = gmpy2.digits(gmpy2.const_pi(),3)[0][4:]  # skip "10."
%o A383502 out = []
%o A383502 for p in range(2, 280):
%o A383502     if isprime(p):
%o A383502         pos = pi_ternary.find(to_base3(p)) + 1
%o A383502         out.append(pos)
%o A383502 print(out)
%Y A383502 Cf. A000040, A178707, A007089, A004602, A004601.
%K A383502 base,nonn
%O A383502 1,1
%A A383502 _James S. DeArmon_, Apr 28 2025