Data update
This commit is contained in:
parent
796d366b97
commit
35bcdeebf8
504 changed files with 7045 additions and 610 deletions
|
|
@ -7,4 +7,4 @@ def is_deceptive(n):
|
|||
if not (n % d and n % (d + 4)): return True
|
||||
return False
|
||||
|
||||
print(*islice(filter(is_deceptive, count()), 100))
|
||||
print(*islice(filter(is_deceptive, count(49)), 100))
|
||||
16
Task/Deceptive-numbers/Python/deceptive-numbers-2.py
Normal file
16
Task/Deceptive-numbers/Python/deceptive-numbers-2.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
from itertools import accumulate, cycle, islice
|
||||
from math import isqrt
|
||||
|
||||
primes = []
|
||||
wheel = 4, 2, 4, 2, 4, 6, 2, 6
|
||||
|
||||
def is_pseudo(n):
|
||||
if pow(10, n - 1, n) == 1:
|
||||
s = isqrt(n)
|
||||
for p in primes:
|
||||
if p > s: break
|
||||
if n % p == 0: return True
|
||||
primes.append(n)
|
||||
return False
|
||||
|
||||
print(*islice(filter(is_pseudo, accumulate(cycle(wheel), initial=7)), 100))
|
||||
Loading…
Add table
Add a link
Reference in a new issue