From 013fab54693b9fc571c42fbe5b9c5332161366ad Mon Sep 17 00:00:00 2001 From: Johannes Wache Date: Fri, 23 Oct 2020 14:40:29 +0200 Subject: [PATCH 1/2] added solution for problem 26 --- Python/26.Reciprocal_cycles/tht_jxny.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 Python/26.Reciprocal_cycles/tht_jxny.py 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]) From 4e1caaba8b32f05e4a8fcf240dbb58ed08dbfec6 Mon Sep 17 00:00:00 2001 From: tht-jxny <37499965+tht-jxny@users.noreply.github.com> Date: Fri, 23 Oct 2020 14:42:53 +0200 Subject: [PATCH 2/2] 26 done in Python3 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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: | | | | | | | | |