Skip to content

Instantly share code, notes, and snippets.

@shakayami
Created October 8, 2021 10:47
Show Gist options
  • Save shakayami/5c80815ae3f806bafca80df998df7be1 to your computer and use it in GitHub Desktop.
Save shakayami/5c80815ae3f806bafca80df998df7be1 to your computer and use it in GitHub Desktop.
'''
出典
https://twitter.com/jajaaankara_kdb/status/1446313136928083972
'''
MAX_N=10**4
isPrime=[True for i in range(MAX_N+1)]
isPrime[0]=False;isPrime[1]=False
for i in range(MAX_N+1):
if isPrime[i]:
for j in range(2*i,MAX_N+1,i):
isPrime[j]=False
Prime=[]
for i in range(MAX_N+1):
if isPrime[i]:
Prime.append(i)
Half_Prime=[]
for p in Prime:
for q in Prime:
if p<q:
Half_Prime.append(p*q)
Half_Prime.sort()
ans=10**100
a_ans=-1
b_ans=-1
for a in Prime:
for b in Half_Prime:
if a<=b:
break
if pow(a-1,10,b)==1 and pow(b,3*a+50,a)==1:
if ans>a+b:
ans=a+b
a_ans=a
b_ans=b
import math
a=a_ans
b=b_ans
X=b+math.log10(a)
Y=a+b-math.log10(3*(b+1)*(5*b-2))
print(a,b)
print(X,Y)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment