-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathe35.py
More file actions
52 lines (36 loc) · 972 Bytes
/
e35.py
File metadata and controls
52 lines (36 loc) · 972 Bytes
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
45
46
47
48
49
50
51
52
#e35
#
#Find number of circular primes below one million
import math
def circularPrimes(primes):
circPrimes = []
for prime in primes:
primeArray = []
for i in str(prime):
primeArray.append(i)
primeLen = len(str(prime))
rotArray[]
j = 0
while j < primeLen:
if j == (primeLen - 1):
rotArray[0] = primeArray[j]
else:
rotArray[j + 1] = primeArray[j]
j += 1
print(primeArray)
print(rotArray)
def primes(num):
primes = [2, 3]
p = 5
while p < num:
i = 2
isPrime = True
while i < math.sqrt(p + 1):
if p % i == 0:
isPrime = False
break
i += 1
if isPrime == True:
primes.append(p)
p += 2
return primes