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.

A382667 Position of the first instance of prime(n), in base 2, in the binary representation of Pi after the binary point.

This page as a plain text file.
%I A382667 #55 Apr 27 2025 08:00:23
%S A382667 3,11,16,11,16,15,25,60,91,14,11,126,58,393,207,18,14,13,6,180,141,
%T A382667 169,58,243,47,326,168,475,15,291,451,108,64,87,327,421,358,41,356,
%U A382667 468,343,16,618,107,80,179,57,206,291,325,361,205,427,12,95,108,436,6,996
%N A382667 Position of the first instance of prime(n), in base 2, in the binary representation of Pi after the binary point.
%C A382667 Positions are numbered starting from 1 for the first bit after the binary point in Pi.
%F A382667 a(n) = A178707(A000040(n)). - _Pontus von Brömssen_, Apr 12 2025
%e A382667 For n=19, the bits of Pi and their numbering, after the binary point, begin
%e A382667           1 2 3 4 5 6 7 8 9 ...
%e A382667    1 1 .  0 0 1 0 0 1 0 0 0 0 1 1 1 1 ...
%e A382667                     \-----------/
%e A382667                     prime(19) = 67
%e A382667 prime(19) = 1000011_2 begins at position a(19) = 6.
%e A382667 prime(58) = 271 = 100001111_2 also starts at 6 => a(58) = 6.
%t A382667 p=Drop[RealDigits[Pi,2,1010][[1]],2](* increase for n>73 *);a[n_]:=First[SequencePosition[p,IntegerDigits[Prime[n],2]][[1]]] (* _James C. McMahon_, Apr 26 2025 *)
%o A382667 (Python)
%o A382667 import gmpy2
%o A382667 from sympy import isprime
%o A382667 gmpy2.get_context().precision = 12000000
%o A382667 gmpy2.get_context().round = gmpy2.RoundDown
%o A382667 pi = gmpy2.const_pi()
%o A382667 binary_pi = gmpy2.digits(pi, 2)[0][2:] # Get binary digits and remove "11"
%o A382667 print([binary_pi.find(bin(cand)[2:])+1 for cand in range(2, 700) if isprime(cand)])
%Y A382667 Cf. A000040, A004601, A178707, A233836, A378472, A382307.
%K A382667 nonn,base
%O A382667 1,1
%A A382667 _James S. DeArmon_, Apr 02 2025