123456789101112131415161718192021222324252627 |
- #!/usr/bin/ruby
- # Daniel "Trizen" Șuteu
- # Edit: 25 July 2021
- # https://github.com/trizen
- # Find the value of d < 1000 for which 1/d contains the longest recurring cycle in its decimal fraction part.
- # https://projecteuler.net/problem=26
- # Runtime: 0.196s
- var d = 1
- var max = 0
- for n in (2..1000) {
- var r = znorder(10, n)
- if (r > max) {
- max = r
- d = n
- }
- }
- say d
|