Skip to content

26 done in Python3 #204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Python/26.Reciprocal_cycles/tht_jxny.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Euler 26
def recurring_cycle(n, d):
# n is numerator and d is denominator
for t in range(1, d):
if 1 == 10**t % d:
return t
return 0

if __name__ == "__main__":
longest = max(recurring_cycle(1, i) for i in range(2,1001))
print([i for i in range(1,1001) if recurring_cycle(1, i) == longest][0])
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Happy Contributing! 😃
| 23 | [Non-abundant sums](https://projecteuler.net/problem=23) | | | | | | | | | | | | |
| 24 | [Lexicographic permutations](https://projecteuler.net/problem=24) | | | | | | | | | | | | |
| 25 | [1000-digit Fibonacci number](https://projecteuler.net/problem=25) | | | | :white_check_mark: | | | | | | | | |
| 26 | [Reciprocal cycles](https://projecteuler.net/problem=26) | | | | | | | | | | | | |
| 26 | [Reciprocal cycles](https://projecteuler.net/problem=26) | | | | :white_check_mark: | | | | | | | | |
| 27 | [Quadratic primes](https://projecteuler.net/problem=27) | | :white_check_mark: | | | | | | | | | | |
| 28 | [Number spiral diagonals](https://projecteuler.net/problem=28) | :white_check_mark: | :white_check_mark: | | :white_check_mark: | | | :white_check_mark: | | | | | |
| 29 | [Distinct powers](https://projecteuler.net/problem=29) | | | | :white_check_mark: | | | | | | | | |
Expand Down