Last active
May 24, 2025 09:25
-
-
Save wai4u/f35c664a2d9405bd838ec67522365cc2 to your computer and use it in GitHub Desktop.
highly composite number
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
< | n | d(n) | factorize | ||
---|---|---|---|---|---|
0 | 10^3 | 840 | 32 | 2^3·3·5·7 | |
1 | 10^6 | 720720 | 240 | 2^4·3^2·5·7·11·13 | |
2 | 10^9 | 735134400 | 1344 | 2^6·3^3·5^2·7·11·13·17 | |
3 | 10^12 | 963761198400 | 6720 | 2^6·3^4·5^2·7·11·13·17·19·23 | |
4 | 10^15 | 866421317361600 | 26880 | 2^6·3^4·5^2·7·11·13·17·19·23·29·31 | |
5 | 10^18 | 897612484786617600 | 103680 | 2^8·3^4·5^2·7^2·11·13·17·19·23·29·31·37 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def primetable(n): | |
isp=[True]*n | |
isp[0]=isp[1]=False | |
for i in range(n): | |
if i*i>=n:break | |
if not isp[i]:continue | |
for j in range(i*i,n,i):isp[j]=False | |
return isp | |
def primes(n): | |
return [i for i,f in enumerate(primetable(n))if f] | |
def hcn(n=10**150): | |
assert n<=10**500 | |
A=[(1,1,[])] | |
for i,p in enumerate(primes(1104)): | |
B=[] | |
for a in A: | |
B.append(a) | |
x,d,e=a | |
if len(e)<i:continue | |
for j in range(1,e[i-1]+1 if i>0 else 17): | |
x*=p | |
if x>n:break | |
B.append((x,d*(j+1),e+[j])) | |
B.sort() | |
A=A[:1] | |
for a in B: | |
if a[1]>A[-1][1]:A.append(a) | |
return A | |
import pandas as pd | |
ls=[None]*20 | |
data=[] | |
for x in hcn(10**18): | |
ls[len(str(x[0]))]=x | |
ps=primes(100) | |
for i in range(3,19,3): | |
x,d,e=ls[i] | |
e='·'.join(str(ps[i])+('' if c==1 else f'^{c}')for i,c in enumerate(e)) | |
data.append((f'10^{i}',x,d,e)) | |
df=pd.DataFrame(data=data,columns=('<','n','d(n)','factorize')) | |
print(df) | |
df.to_csv('hcn.csv') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment