Wednesday, June 12, 2019

Prime Distances 2

I took the first 10K (more or less) primes and made a file of the last digits. {
 https://drive.google.com/open?id=1iVTHNs9oeX5LPYQr0VgiaUwUOoXUuHBb
(lastdigit0.txt in google drive) }

Then looked at pairs of digits and counted frequencies. Used gawk script called pairs.txt below.

Below is summary:

Summary of pair frequencies of first 10K (more or less) last digit prime numbers. 

#file below is gawk program called pairs1.txt
BEGIN{ print "look for pair frequency"
previous=1
ar[3,5]=8;
}
{ current = $1
ar[previous,current]++;
#print previous, $1, ar[1,3];  
 previous = current;
 }
 END {
 for(i=0;i<10;i++) {
for(j=0;j<10;j++) {
#print i,j,ar[i,j];
}
 }
 print "--", ar[1,1],ar[1,3],ar[1,7],ar[1,9];
 print "--", ar[3,1],ar[3,3],ar[3,7],ar[3,9];
 print "--", ar[7,1],ar[7,3],ar[7,7],ar[7,9];
 print "--", ar[9,1],ar[9,3],ar[9,7],ar[9,9];
 print "NR = ", NR
  s[1] =ar[1,1]+ar[1,3]+ar[1,7]+ar[1,9];
  s[3] =ar[3,1]+ar[3,3]+ar[3,7]+ar[3,9];
  s[7] =ar[7,1]+ar[7,3]+ar[7,7]+ar[7,9];
  s[9] =ar[9,1]+ar[9,3]+ar[9,7]+ar[9,9];
  print "Sums are ", s[1],s[3],s[7],s[9];
  print "Proportions for 1,x are: " ar[1,1]/s[1],ar[1,3]/s[1], ar[1,7]/s[1],ar[1,9]/s[1]
   print "Proportions for 3,x are: " ar[3,1]/s[3],ar[3,3]/s[3], ar[3,7]/s[3],ar[3,9]/s[3]
    print "Proportions for 7,x are: " ar[7,1]/s[7],ar[7,3]/s[7], ar[7,7]/s[7],ar[7,9]/s[7]
print "Proportions for 9,x are: " ar[9,1]/s[9],ar[9,3]/s[9], ar[9,7]/s[9],ar[9,9]/s[9]
}
---------------output--------------
NPP_SAVE: C:\Users\Dell\Documents\Primes\Distances0\gawkStuff\pairs1.txt
CD: C:\Users\Dell\Documents\Primes\Distances0\gawkStuff
Current directory: C:\Users\Dell\Documents\Primes\Distances0\gawkStuff
INPUTBOX: "Script arguments : "
local $(INPUT) = C:\Users\Dell\Documents\Primes\PrimeLists\lastdigit0.txt
local $(INPUT[1]) = C:\Users\Dell\Documents\Primes\PrimeLists\lastdigit0.txt
Script input arguments, @ARGV : C:\Users\Dell\Documents\Primes\PrimeLists\lastdigit0.txt
"C:\Users\Dell\Desktop\Setup Files\GnuWin\GetGnuWin32\gnuwin32\bin\gawk.exe"    -f  C:\Users\Dell\Documents\Primes\Distances0\gawkStuff\pairs1.txt C:\Users\Dell\Documents\Primes\PrimeLists\lastdigit0.txt
Process started (PID=18032) >>>
look for pair frequency
-- 351 795 860 380
-- 508 307 716 870
-- 629 696 311 775
-- 899 603 523 365
NR =  9592
Sums are  2386 2401 2411 2390
Proportions for 1,x are: 0.147108 0.333194 0.360436 0.159262
Proportions for 3,x are: 0.211579 0.127863 0.298209 0.362349
Proportions for 7,x are: 0.260888 0.288677 0.128992 0.321443
Proportions for 9,x are: 0.376151 0.252301 0.218828 0.15272
<<< Process finished (PID=18032). (Exit code 0)
================ READY ================
Looking at the big red number above, it tells us that 3,7 pair turns up 29.8209% of the total pairs of the form 3,x.  We would expect these numbers to all be 0.25 plus or minus a little bit.
Note the lowest number in each row is 1,1 or 3,3 or 7,7 or 9,9. Conclusion there's a low probability for repetition.

No comments:

Post a Comment