-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprimedoubles.py
45 lines (26 loc) · 1.03 KB
/
primedoubles.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import primesieve
import numpy as np
#The following code was used to collect data on consecutive primes. Specifically, it iterated through all primes
#under 10000000 and kept count of all instances of a prime ending in x, and the next prime ending in y.
#e.g. kept count of all instances of a prime ending in 1, and the next prime ending in 3.
# **As well as all other digit pair combinations.
np.set_printoptions(suppress=True)
base = int( input("What base?"))
count = np.zeros((base,base)) # Create an array of all zeros
prev = 0
curr = 0
it = primesieve.Iterator()
prime = it.next_prime()
# Iterate over the primes below blah
while prime < 10000000:
curr = prime % base
count[prev,curr] += 1
prev = curr
prime = it.next_prime()
print("\nObserving results for base " + str(base))
for x in range(1, base):
print("Primes of form " + str(x) + ":x")
for y in range(1, base):
if (count[x,y] > 1):
print("\t"+ str(y) + ":::" + str(count[x,y]))
##are bases generally preferred to be products of first k primes?