From 7381f239c2ebdca65f80c3790662968e12c6e56a Mon Sep 17 00:00:00 2001 From: PapaRaG3 <41174949+dickeyy@users.noreply.github.com> Date: Fri, 3 Dec 2021 01:11:14 -0700 Subject: [PATCH] Updated README, added .json --- .gitignore | 0 README.md | 4 ++-- src/.DS_Store | Bin 6148 -> 6148 bytes src/.gitignore | 1 - src/__pycache__/gui.cpython-39.pyc | Bin 1819 -> 0 bytes src/lastSuccessful.json | 4 ++++ 6 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 .gitignore delete mode 100644 src/.gitignore delete mode 100644 src/__pycache__/gui.cpython-39.pyc create mode 100644 src/lastSuccessful.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/README.md b/README.md index 52b86ac..1cc2771 100644 --- a/README.md +++ b/README.md @@ -3,14 +3,14 @@ This is an algorithm custom built by Kyle Dickey, used to test numbers against the simple rules of the Collatz Conjecture. ## Get started -If you want to try the calculator for yourself, simply clone this repository and open up the file `/src/exe/CollatzCalculator.exe` (basically find the .exe file called CollatzCalculator.exe) and open it up, you will be prompted to enter a number and the algorithm will calculate it. Alternatively, you can clone the repo and run the `calculator.py` file and see all the steps the algorithm goes through, if you go with this option, you can also have it randomly choose a number if you dont feel like thinking. +To get started and try out the calculator for yourself, download the [Latest Release](https://github.com/dickeyy/Collatz-Calculator/releases). Extract the .zip file. There are a few different files you can try out, first, navigate to `src/calculator.py`, run this file for a console based calculator. This file allows the use of custom number inputs and a randomly generated number. Next, head over to `src/sequential.py`, this file simply starts at 1 and tests every number against the algorithm for infinity and saves it in `lastSuccessful.json` so when the script is restarted, it can start back from its last successful test instead of starting from 1. Lastly, go to `src/exe/CollatzCalculator.exe`, when this file is ran, it will open up a gui window and allow you to input a number to test, it will then report when the loop has been reached and how long it took (if the .exe doesn't work, run `src/guiCalc.py`). ## Sequential.py There is also a file called Sequential.py (`src/sequetial.py`), in this file the algorithm goes through every number possible. It starts with 1 and will count up trying every number until it runs into a problem. The file will also create a file called `lastSuccessful.json` and store the last successfully tested number, incase the file crashes so it doesnt have to restart whenever the script is stopped. This file is really not very useful since every number up to like 260 quadrillion has been tested but its a cool proof of concept and I imagine if you put it on a server and let it run forever eventually it may be useful. ## What is the Collatz Conjecture? The conjecture states: You take any positive integer, 1-infinity, and apply two simple rules to it, those rules being if the number you have is even then divide it by two, if its odd then multiply by three and add one you keep doing this with each new number that you get based of the result of the rule that you just applied, -for example, **10**, 10 is even so divide by 2 and you get **5** thats odd so times 3 add one is **16** thats even so divide by 2 thats **4** divide by 2 again and you get **1** thats odd so multiply by 3 and add 1, but wait thats **4**... see the loop? The conjecture states that all positive numbers will eventually come back to this **4-2-1-4** loop after applying the two rules however many times. So far mathematicians have yet to find a number that breaks this rule and every number all the way up to like 260 quadrillion has been tested or something so, so far there isn't a number that goes against this conjecture. +for example, **10**, 10 is even so divide by 2 and you get **5** thats odd so times 3 add one is **16** thats even so divide by 2 thats **4** divide by 2 again and you get **1** thats odd so multiply by 3 and add 1, but wait thats **4**... see the loop? The conjecture states that all positive numbers will eventually come back to this **4-2-1-4** loop after applying the two rules however many times. So far mathematicians have yet to find a number that breaks this rule and every number all the way up to like 300 quintillion has been tested or something so, so far there isn't a number that goes against this conjecture. ## About this Algorithm This is likely not as efficient as it could be and there is probably some ways I messed up. Also, the algorithm could be a lot shorter (something like 10 lines total) but i included all the other stuff to communicate with the user and all that. All that being said, the algorithm does work and it will test any number you want in fractions of a second. \ No newline at end of file diff --git a/src/.DS_Store b/src/.DS_Store index aa8998de885deeb4852624105bce354ad92c9fe8..2c0350ebac44594bc5676978da48c6c0cd0bcea2 100644 GIT binary patch delta 75 zcmZoMXfc=|&e%4wP;8=}q6iZM0|O%ig8)NvPEvk;4v@*fJn^B%WCIbFjhjN*Cw@@g d%+4Xe!PvI(;dkcA{35!nASDMj+lm}!1_0&{6m0+i delta 105 zcmZoMXfc=|&e%S&P;8=}q9`*10|O%ig8&0VGD9K|XE3BP#7{h^t^$(aW{3yE0)|Rt uNrw28;^ds9{QMk-jXe?Uo7p)8I2hYE9{kQcnO{Vgkzuo=$YJJ*4J-i2ml=}) diff --git a/src/.gitignore b/src/.gitignore deleted file mode 100644 index 3c5c13f..0000000 --- a/src/.gitignore +++ /dev/null @@ -1 +0,0 @@ -lastSuccessful.json \ No newline at end of file diff --git a/src/__pycache__/gui.cpython-39.pyc b/src/__pycache__/gui.cpython-39.pyc deleted file mode 100644 index 4bcc3c05419ac0323d0a537c24587170589711d9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1819 zcmZWpOLG-P6z=JH-bWsU1R?|&1e6iDA&5MxEWIYdDhi9T02j`}ICoCx-brSrLr-6l zT$3s+*j~$xY%Hphr8|EDOMif?E_ZIs+Kr-Bc=|p<)S2pUPJeyQ>F(2CPc$-8CiwjR z)pyY|mylm|=isA9>)48#K?o2qQj!^=k9?qt^v53|EK!zu9L zG`tCCx)!egES!5v!bzt62%Chr;BAbVg7Xk`y>N<6VZ=Ld0WQL&egy952-KjqtJhfB zIl4h{83aW`&KT+rm`Ne4XK>@wv;?qYzq6S#e=&(y*`{*eyLNNq+SSV)_so^WD>vS~ z6&Q*(n#p5INb(#(*&=}^3ml;jQ#mb`G+R>H>j}sfx`LW$A(LuWwlHaq3s8<=X~LER zs*DX~Y&P{)^wT$f`no<~p4JsXCu=!LQ|0ouOp~1Lo!|E)SL=%A>z#@J?*vzTloRD~iwk8*td*F=lsFB~<=!(iJEOPrwYKylKW}FZ zCNSCJ+~W0Hmjf!MaXk42lkDO4admy-XPwm+qe%5CA;z?I96{0LW`8>`J|FHY85l1f z4UETk>VYK=>6i%(BO0m*F}D53M9agrfUWojL6RL~muwSBx5yJ?8*fl#N^8g3C6O&n zpw~%cZV@n#;K(W!i`qVc{`jTX|Kj174`_SFD3SA!M6)nD= z)tU~fNRbgqgRxo&g{yz|L0bO6-o&Bs}qL^Jp(L+!3vx_`#XE<3gyTE}V z^e)LqX_JdYwz45{=`~Y`c(&P2YHOQnywSUKOLI$cs?))TI7{Ip5W_P()1sc~nN`E1 zo?%(Y=r1H<;FbAq8!9HhKpkw^i32e zHE8|ywO3yrDDB72P;x6n<9_|)U|P9y6>G|b(6Sc#;Dn{Y*5GJxHRuA1a|n2eaax`! zLnsHU4SZeMGLb1$UX$^R=|52kPj5MCwgpp8JorbgrBTe(c#IN|Y)P zAy4aRdKK}86;&m{ilh@Y^bA>)f%$!DC1kD u)cDu?r&AiG)!`fvY0hQFNGqklWDcj~}cKkFY(Wj`K0s>VOHU(PoG diff --git a/src/lastSuccessful.json b/src/lastSuccessful.json new file mode 100644 index 0000000..6b337cf --- /dev/null +++ b/src/lastSuccessful.json @@ -0,0 +1,4 @@ +{ + "number": 1, + "startedAt": "" +} \ No newline at end of file