{"id":9533877,"url":"https://github.com/lcsm29/project-euler","last_synced_at":"2025-08-23T20:31:23.449Z","repository":{"id":239506652,"uuid":"371808781","full_name":"lcsm29/project-euler","owner":"lcsm29","description":"My solutions for Project Euler problems in Python, C, C++, C#, F#, Go, Haskell, Java, JavaScript, PHP, Ruby, SQL","archived":false,"fork":false,"pushed_at":"2021-08-07T08:21:08.000Z","size":2776,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-21T14:36:14.592Z","etag":null,"topics":["c","cpp","cs","fs","go","hs","java","js","php","project-euler","py","python","rb","solutions","sql"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lcsm29.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-05-28T20:12:45.000Z","updated_at":"2021-08-07T08:21:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"81148ba4-7a46-4120-a307-2ac9a8618b26","html_url":"https://github.com/lcsm29/project-euler","commit_stats":null,"previous_names":["lcsm29/project-euler"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lcsm29/project-euler","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lcsm29%2Fproject-euler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lcsm29%2Fproject-euler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lcsm29%2Fproject-euler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lcsm29%2Fproject-euler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lcsm29","download_url":"https://codeload.github.com/lcsm29/project-euler/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lcsm29%2Fproject-euler/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271767988,"owners_count":24817592,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-23T02:00:09.327Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","cpp","cs","fs","go","hs","java","js","php","project-euler","py","python","rb","solutions","sql"],"created_at":"2024-05-12T23:43:37.882Z","updated_at":"2025-08-23T20:31:23.440Z","avatar_url":"https://github.com/lcsm29.png","language":"Python","funding_links":[],"categories":["Repositories"],"sub_categories":[],"readme":"# Solutions for [Project Euler](https://projecteuler.net/)\nThese are my solutions for [Project Euler problems](https://projecteuler.net/archives). I've listed many languages in the About section on the right. However, I can barely code in Python and absolutely nothing in any other language at this moment, since I've started coding about 2 months ago. Hence, that's more like a wishlist than an actual description, at least for now.\n\nAll code in this repo is runnable, and gives you a comparison of the execution times of each implementation (overall execution times of each implementation for the predetermined number of iterations, as well as min/avg/max of single run). It is tested whether the solution provides a correct answer for the given variable, but may produce an error on different variable. I'm planning to add more testing.\n\nMain files on each folder (e.g. [main.py](https://github.com/lcsm29/project-euler/blob/main/py/main.py)) will run every function implemented on every problems I've solved so far. By default, each problem takes about a second to finish the entire iterations on my computer, so it'll take about a couple of minutes to run if I ever write the solutions for every problems. Right now, it takes 10 seconds.\n\n## Current Progress\n| Languages                                                                      |     Progress      |\n| ------------------------------------------------------------------------------ | ----------------- |\n| [Python](https://github.com/lcsm29/project-euler/tree/main/py)                 |     30 / 747      |\n| [C](https://github.com/lcsm29/project-euler/tree/main/c)                       |      0 / 747      |\n| [C++](https://github.com/lcsm29/project-euler/tree/main/cpp)                   |      0 / 747      |\n| [C#](https://github.com/lcsm29/project-euler/tree/main/cs)                     |      0 / 747      |\n| [F#](https://github.com/lcsm29/project-euler/tree/main/fs)                     |      0 / 747      |\n| [Go](https://github.com/lcsm29/project-euler/tree/main/go)                     |      0 / 747      |\n| [Haskell](https://github.com/lcsm29/project-euler/tree/main/hs)                |      0 / 747      |\n| [Java](https://github.com/lcsm29/project-euler/tree/main/java)                 |      0 / 747      |\n| [JavaScript](https://github.com/lcsm29/project-euler/tree/main/js)             |      0 / 747      |\n| [PHP](https://github.com/lcsm29/project-euler/tree/main/php)                   |      0 / 747      |\n| [Ruby](https://github.com/lcsm29/project-euler/tree/main/rb)                   |      0 / 747      |\n| [SQL](https://github.com/lcsm29/project-euler/tree/main/sql)                   |      0 / 747      |\n\n\n## Scoreboard\nThis section hasn't been fully implemented yet. This is my attempt to compare the crunching speed of each language, but there are many limitations. The first and foremost limitation would be: each implementation of each language may use slightly different algorithms (or substantially different one in some cases), due to various reasons, including the differences in features, data types, or styles of each language, my own limited capability, et cetera. Also, each language may have a varying degree of optimization. As such, this is more like the comparison between apple and orange, rather than apple to apple comparison.\n\n### Average execution time (in nanoseconds, unless specified) (lower is better)\nThis table shows how much nanoseconds it took for the fastest algo to complete one iteration on average. I haven't implemented the auto-update feature yet (except for Python), but once implemented, running main files on each folder (e.g. [main.py](https://github.com/lcsm29/project-euler/blob/main/py/main.py)) will trigger the automatic update of this table.\n| Problems  | py         | pypy       | c          | cpp        | cs         | fs         | go         | hs         | java       | js         | php        | rb         | sql        |\n| --------- | ---------- | ---------- | ---------- | ---------- | ---------- | ---------- | ---------- | ---------- | ---------- | ---------- | ---------- | ---------- | ---------- |\n| 1         |[        581 ](https://github.com/lcsm29/project-euler/blob/main/py/py_0001_multiples_of_3_and_5.py)|[         25 ](https://github.com/lcsm29/project-euler/blob/main/py/py_0001_multiples_of_3_and_5.py)|            |            |            |            |            |            |            |            |            |        982 |            |\n| 2         |[      2,160 ](https://github.com/lcsm29/project-euler/blob/main/py/py_0002_even_fibonacci_numbers.py)|[        131 ](https://github.com/lcsm29/project-euler/blob/main/py/py_0002_even_fibonacci_numbers.py)|            |            |            |            |            |            |            |            |            |            |            |\n| 3         |[    314,980 ](https://github.com/lcsm29/project-euler/blob/main/py/py_0003_largest_prime_factor.py)|[      5,755 ](https://github.com/lcsm29/project-euler/blob/main/py/py_0003_largest_prime_factor.py)|            |            |            |            |            |            |            |            |            |            |            |\n| 4         |[    521,115 ](https://github.com/lcsm29/project-euler/blob/main/py/py_0004_largest_palindrome_product.py)|[     46,393 ](https://github.com/lcsm29/project-euler/blob/main/py/py_0004_largest_palindrome_product.py)|            |            |            |            |            |            |            |            |            |            |            |\n| 5         |[     50,807 ](https://github.com/lcsm29/project-euler/blob/main/py/py_0005_smallest_multiple.py)|[     17,003 ](https://github.com/lcsm29/project-euler/blob/main/py/py_0005_smallest_multiple.py)|            |            |            |            |            |            |            |            |            |            |            |\n| 6         |[        220 ](https://github.com/lcsm29/project-euler/blob/main/py/py_0006_sum_square_difference.py)|[         35 ](https://github.com/lcsm29/project-euler/blob/main/py/py_0006_sum_square_difference.py)|            |            |            |            |            |            |            |            |            |            |            |\n| 7         |[    9,436μs ](https://github.com/lcsm29/project-euler/blob/main/py/py_0007_10001st_prime.py)|[    1,311μs ](https://github.com/lcsm29/project-euler/blob/main/py/py_0007_10001st_prime.py)|            |            |            |            |            |            |            |            |            |            |            |\n| 8         |[    1,406μs ](https://github.com/lcsm29/project-euler/blob/main/py/py_0008_largest_product_in_a_series.py)|[    165,874 ](https://github.com/lcsm29/project-euler/blob/main/py/py_0008_largest_product_in_a_series.py)|            |            |            |            |            |            |            |            |            |            |            |\n| 9         |[   19,685μs ](https://github.com/lcsm29/project-euler/blob/main/py/py_0009_special_pythagorean_triplet.py)|[     61,736 ](https://github.com/lcsm29/project-euler/blob/main/py/py_0009_special_pythagorean_triplet.py)|            |            |            |            |            |            |            |            |            |            |            |\n| 10        |[  163,380μs ](https://github.com/lcsm29/project-euler/blob/main/py/py_0010_summation_of_primes.py)|[   33,435μs ](https://github.com/lcsm29/project-euler/blob/main/py/py_0010_summation_of_primes.py)|            |            |            |            |            |            |            |            |            |            |            |\n| 11        |[    801,136 ](https://github.com/lcsm29/project-euler/blob/main/py/py_0011_largest_product_in_a_grid.py)|[    103,612 ](https://github.com/lcsm29/project-euler/blob/main/py/py_0011_largest_product_in_a_grid.py)|            |            |            |            |            |            |            |            |            |            |            |\n| 12        |[  155,919μs ](https://github.com/lcsm29/project-euler/blob/main/py/py_0012_highly_divisible_triangular_number.py)|[   30,274μs ](https://github.com/lcsm29/project-euler/blob/main/py/py_0012_highly_divisible_triangular_number.py)|            |            |            |            |            |            |            |            |            |            |            |\n| 13        |[      1,935 ](https://github.com/lcsm29/project-euler/blob/main/py/py_0013_large_sum.py)|[      2,570 ](https://github.com/lcsm29/project-euler/blob/main/py/py_0013_large_sum.py)|            |            |            |            |            |            |            |            |            |            |            |\n| 14        |[  777,981μs ](https://github.com/lcsm29/project-euler/blob/main/py/py_0014_longest_collatz_sequence.py)|[  407,915μs ](https://github.com/lcsm29/project-euler/blob/main/py/py_0014_longest_collatz_sequence.py)|            |            |            |            |            |            |            |            |            |            |            |\n| 15        |[      1,702 ](https://github.com/lcsm29/project-euler/blob/main/py/py_0015_lattice_paths.py)|[        404 ](https://github.com/lcsm29/project-euler/blob/main/py/py_0015_lattice_paths.py)|            |            |            |            |            |            |            |            |            |            |            |\n| 16        |[     23,152 ](https://github.com/lcsm29/project-euler/blob/main/py/py_0016_power_digit_sum.py)|[     13,352 ](https://github.com/lcsm29/project-euler/blob/main/py/py_0016_power_digit_sum.py)|            |            |            |            |            |            |            |            |            |            |            |\n| 17        |[    1,472μs ](https://github.com/lcsm29/project-euler/blob/main/py/py_0017_number_letter_counts.py)|[    584,939 ](https://github.com/lcsm29/project-euler/blob/main/py/py_0017_number_letter_counts.py)|            |            |            |            |            |            |            |            |            |            |            |\n| 18        |[     38,705 ](https://github.com/lcsm29/project-euler/blob/main/py/py_0018_maximum_path_sum_i.py)|[     21,386 ](https://github.com/lcsm29/project-euler/blob/main/py/py_0018_maximum_path_sum_i.py)|            |            |            |            |            |            |            |            |            |            |            |\n| 19        |[    145,267 ](https://github.com/lcsm29/project-euler/blob/main/py/py_0019_counting_sundays.py)|[      5,966 ](https://github.com/lcsm29/project-euler/blob/main/py/py_0019_counting_sundays.py)|            |            |            |            |            |            |            |            |            |            |            |\n| 20        |[     12,553 ](https://github.com/lcsm29/project-euler/blob/main/py/py_0020_factorial_digit_sum.py)|[      7,740 ](https://github.com/lcsm29/project-euler/blob/main/py/py_0020_factorial_digit_sum.py)|            |            |            |            |            |            |            |            |            |            |            |\n| 21        |[   92,111μs ](https://github.com/lcsm29/project-euler/blob/main/py/py_0021_amicable_numbers.py)|[  117,632μs ](https://github.com/lcsm29/project-euler/blob/main/py/py_0021_amicable_numbers.py)|            |            |            |            |            |            |            |            |            |            |            |\n| 22        |[    3,092μs ](https://github.com/lcsm29/project-euler/blob/main/py/py_0022_names_scores.py)|[    2,909μs ](https://github.com/lcsm29/project-euler/blob/main/py/py_0022_names_scores.py)|            |            |            |            |            |            |            |            |            |            |            |\n| 23        |[    1,111ms ](https://github.com/lcsm29/project-euler/blob/main/py/py_0023_non-abundant_sums.py)|[  604,644μs ](https://github.com/lcsm29/project-euler/blob/main/py/py_0023_non-abundant_sums.py)|            |            |            |            |            |            |            |            |            |            |            |\n| 24        |[   13,230μs ](https://github.com/lcsm29/project-euler/blob/main/py/py_0024_lexicographic_permutations.py)|[   27,619μs ](https://github.com/lcsm29/project-euler/blob/main/py/py_0024_lexicographic_permutations.py)|            |            |            |            |            |            |            |            |            |            |            |\n| 25        |[   22,750μs ](https://github.com/lcsm29/project-euler/blob/main/py/py_0025_1000-digit_fibonacci_number.py)|[   88,062μs ](https://github.com/lcsm29/project-euler/blob/main/py/py_0025_1000-digit_fibonacci_number.py)|            |            |            |            |            |            |            |            |            |            |            |\n| 26        |[   14,905μs ](https://github.com/lcsm29/project-euler/blob/main/py/py_0026_reciprocal_cycles.py)|[    5,679μs ](https://github.com/lcsm29/project-euler/blob/main/py/py_0026_reciprocal_cycles.py)|            |            |            |            |            |            |            |            |            |            |            |\n| 27        |[   40,082μs ](https://github.com/lcsm29/project-euler/blob/main/py/py_0027_quadratic_primes.py)|[    4,081μs ](https://github.com/lcsm29/project-euler/blob/main/py/py_0027_quadratic_primes.py)|            |            |            |            |            |            |            |            |            |            |            |\n| 28        |[    239,247 ](https://github.com/lcsm29/project-euler/blob/main/py/py_0028_number_spiral_diagonals.py)|[      7,370 ](https://github.com/lcsm29/project-euler/blob/main/py/py_0028_number_spiral_diagonals.py)|            |            |            |            |            |            |            |            |            |            |            |\n| 29        |[    4,068μs ](https://github.com/lcsm29/project-euler/blob/main/py/py_0029_distinct_powers.py)|[    8,549μs ](https://github.com/lcsm29/project-euler/blob/main/py/py_0029_distinct_powers.py)|            |            |            |            |            |            |            |            |            |            |            |\n| 30        |[  716,723μs ](https://github.com/lcsm29/project-euler/blob/main/py/py_0030_digit_fifth_powers.py)|[   67,669μs ](https://github.com/lcsm29/project-euler/blob/main/py/py_0030_digit_fifth_powers.py)|            |            |            |            |            |            |            |            |            |            |            |\n* The table above is auto-generated from the following environments;\n  * py: Python 3.9.5.final.0 (64 bit), macOS 11.4 (arm64), Apple M1\n  * pypy: PyPy 7.3.5 with GCC Apple LLVM 12.0.5 (clang-1205.0.22.9), macOS 11.4 (x86_64), Apple M1\n  * rb: Ruby 3.0.1p64, Windows 10 Professional (AMD64), Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz\n\n### Number of Iterations (higher is better)\nThis table shows how much iterations it computes for about a second.\n| Problems  | py         | pypy       | c          | cpp        | cs         | fs         | go         | hs         | java       | js         | php        | rb         | sql        |\n| --------- | ---------- | ---------- | ---------- | ---------- | ---------- | ---------- | ---------- | ---------- | ---------- | ---------- | ---------- | ---------- | ---------- |\n| 1         |     65,000 |    600,000 |            |            |            |            |            |            |            |            |            |      4,000 |            |\n| 2         |    150,000 |  1,000,000 |            |            |            |            |            |            |            |            |            |            |            |\n| 3         |      1,500 |     26,000 |            |            |            |            |            |            |            |            |            |            |            |\n| 4         |        420 |      2,200 |            |            |            |            |            |            |            |            |            |            |            |\n| 5         |     20,000 |     60,000 |            |            |            |            |            |            |            |            |            |            |            |\n| 6         |     44,000 |  1,500,000 |            |            |            |            |            |            |            |            |            |            |            |\n| 7         |        110 |        780 |            |            |            |            |            |            |            |            |            |            |            |\n| 8         |        700 |      7,000 |            |            |            |            |            |            |            |            |            |            |            |\n| 9         |         50 |     17,000 |            |            |            |            |            |            |            |            |            |            |            |\n| 10        |          6 |         32 |            |            |            |            |            |            |            |            |            |            |            |\n| 11        |      1,250 |      9,500 |            |            |            |            |            |            |            |            |            |            |            |\n| 12        |          7 |         31 |            |            |            |            |            |            |            |            |            |            |            |\n| 13        |     25,000 |     10,000 |            |            |            |            |            |            |            |            |            |            |            |\n| 14        |          2 |          3 |            |            |            |            |            |            |            |            |            |            |            |\n| 15        |    560,000 |  2,300,000 |            |            |            |            |            |            |            |            |            |            |            |\n| 16        |     43,000 |     80,000 |            |            |            |            |            |            |            |            |            |            |            |\n| 17        |        680 |      1,650 |            |            |            |            |            |            |            |            |            |            |            |\n| 18        |     26,000 |     27,000 |            |            |            |            |            |            |            |            |            |            |            |\n| 19        |      3,200 |     31,000 |            |            |            |            |            |            |            |            |            |            |            |\n| 20        |     34,000 |     65,000 |            |            |            |            |            |            |            |            |            |            |            |\n| 21        |         11 |         10 |            |            |            |            |            |            |            |            |            |            |            |\n| 22        |        320 |        350 |            |            |            |            |            |            |            |            |            |            |            |\n| 23        |          1 |          2 |            |            |            |            |            |            |            |            |            |            |            |\n| 24        |         77 |         35 |            |            |            |            |            |            |            |            |            |            |            |\n| 25        |         45 |         11 |            |            |            |            |            |            |            |            |            |            |            |\n| 26        |         12 |          6 |            |            |            |            |            |            |            |            |            |            |            |\n| 27        |         25 |        240 |            |            |            |            |            |            |            |            |            |            |            |\n| 28        |      4,500 |    130,000 |            |            |            |            |            |            |            |            |            |            |            |\n| 29        |        250 |        125 |            |            |            |            |            |            |            |            |            |            |            |\n| 30        |          2 |         14 |            |            |            |            |            |            |            |            |            |            |            |\n* Each main script not just runs the fastest algo, but runs every implementations. Thus, doing poorly on some algo could hamper the result greatly, even if the language is pretty fast on most implementations.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flcsm29%2Fproject-euler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flcsm29%2Fproject-euler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flcsm29%2Fproject-euler/lists"}