We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1b45e7b commit 076f202Copy full SHA for 076f202
1 file changed
project_euler/problem_025/sol1.rb
@@ -18,13 +18,12 @@
18
#The 12th term, F12, is the first term to contain three digits.
19
#What is the index of the first term in the Fibonacci sequence to contain 1000 digits?
20
21
-def solution?()
+def solution(num_digits = 1000)
22
#Fn = Fn−1 + Fn−2, where F1 = 1 and F2 = 1.
23
resultn1 = 1
24
resultn2 = 1
25
result = 2
26
index = 3
27
- num_digits = 1000
28
value = true
29
while value
30
resultn2 = resultn1
@@ -40,6 +39,6 @@ def solution?()
40
39
res = index
41
end
42
43
-answer = solution?()
+answer = solution()
44
p answer
45
0 commit comments