diff --git a/Python/26.Reciprocal_cycles/tht_jxny.py b/Python/26.Reciprocal_cycles/tht_jxny.py new file mode 100644 index 0000000..757b1fb --- /dev/null +++ b/Python/26.Reciprocal_cycles/tht_jxny.py @@ -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]) diff --git a/README.md b/README.md index b794d72..3332d84 100644 --- a/README.md +++ b/README.md @@ -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: | | | | | | | | |