This file contains 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
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 21, | |
"id": "1c194bcf", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stderr", | |
"output_type": "stream", | |
"text": [ | |
" 1%|▋ | 913/99999 [00:00<00:10, 9059.83it/s]" | |
] | |
}, | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"2\n", | |
"0 1 1\n" | |
] | |
}, | |
{ | |
"name": "stderr", | |
"output_type": "stream", | |
"text": [ | |
"100%|████████████████████████████████████████████████████████████████████████████| 99999/99999 [19:25<00:00, 85.83it/s]\n" | |
] | |
} | |
], | |
"source": [ | |
"from tqdm import tqdm\n", | |
"import time\n", | |
"\n", | |
"def ModRoot(a,n):\n", | |
" \n", | |
" r=[]\n", | |
" amod=a%n\n", | |
" for m in range(n):\n", | |
" if (m*m)%n==amod:\n", | |
" r.append(m)\n", | |
" \n", | |
" return r\n", | |
" \n", | |
"Nmax=10**5\n", | |
"Nmin=2\n", | |
"for n in tqdm(range(Nmin,Nmax+1)):\n", | |
" Mod2=ModRoot(2,n)\n", | |
" if Mod2!=[]:\n", | |
" Mod3=ModRoot(3,n)\n", | |
" if Mod3!=[]:\n", | |
" Mod5=ModRoot(5,n)\n", | |
" if Mod5!=[]:\n", | |
" #print(n)\n", | |
" for a2 in Mod2:\n", | |
" for a3 in Mod3:\n", | |
" for a5 in Mod5:\n", | |
" if (a2+a3)%n==a5:\n", | |
" print(n)\n", | |
" print(a2,a3,a5)" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3 (ipykernel)", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.8.11" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 5 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment