Skip to content

Instantly share code, notes, and snippets.

@koba-e964
Created December 15, 2023 02:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koba-e964/2de3a6480749241f424c4e110a440503 to your computer and use it in GitHub Desktop.
Save koba-e964/2de3a6480749241f424c4e110a440503 to your computer and use it in GitHub Desktop.
List of numbers of prime factors with N <= 10^18
#primes min prod last prime
0 1 1
1 2 2
2 6 3
3 30 5
4 210 7
5 2310 11
6 30030 13
7 510510 17
8 9699690 19
9 223092870 23
10 6469693230 29
11 200560490130 31
12 7420738134810 37
13 304250263527210 41
14 13082761331670030 43
15 614889782588491410 47
#!/usr/bin/env python3
limit = 10**18
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53]
x = 1
count = 0
print("|#primes|min prod|last prime|\n|--|--|--|")
while x <= limit:
print(f"|{count}|{x}|{primes[count-1] if count > 0 else 1}|")
x *= primes[count]
count += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment