View Single Post
Old 2022-02-04, 15:54   #1
robert44444uk's Avatar
Jun 2003
Suva, Fiji

204010 Posts
Default Primes in order in pi

I am a little surprised I can't find any mention on the web, of the sequence of primes, in order, that might be found in the decimal expansion of pi (3.1415926535..)

The first instance of 2 is at the 6th decimal position, the first 3 thereafter at the 9th position, the first 5 thereafter at the 10th, etc.

For definition's sake, the first 71 is not at the 1757th position following 67 at the 1756th, as the 1757th position was also used to ascertain 67. Instead, 71 is found at the 1923rd.

A file of the decimal positions of all primes up to 8713 which are to be found in order in the first 10,000,000 decimal positions of pi is attached.

A graph is also shown, showing the positions of each prime, supporting the hypothesis that pi is normal. Some of the results are shown below

The calculation is trivial. My average 7 year old desktop carried out the following perl program in less than 10 seconds.

#!/usr/bin/env perl
use warnings;
use strict;
use Math::Prime::Util qw/:all/;
use feature ':5.10';


my $pie = substr(Pi(10_000_000),2);
my $maxprime = 100_000;
my $prevplace = 0;
forprimes {
	my $i = 1+index($pie,$_,$prevplace);
	say $_, " ", $i;
	$prevplace = $i+length($_)-1; 
	if ( $i==0){
} 2,$maxprime;
So...the challenge (as this is the puzzle subsection) is to expand the series, and perhaps find quite large gaps or close instances..and post to OEIS
Attached Thumbnails
Click image for larger version

Name:	primesinpi.JPG
Views:	118
Size:	51.6 KB
ID:	26499  
Attached Files
File Type: txt pieres.txt (14.3 KB, 61 views)
robert44444uk is offline   Reply With Quote