In mathematics, a Fermat Number is a positive integer of the form
F
n
=
2
(
2
n
)
+
1
Given that
F
7
=
3
4
0
2
8
2
3
6
6
9
2
0
9
3
8
4
6
3
4
6
3
3
7
4
6
0
7
4
3
1
7
6
8
2
1
1
4
5
7
,
what are the last three digits of the smallest prime factor of
F
7
?
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
I wrote a program in Ruby to produce the lowest prime factor of a number, but it fails if you input a number of more than around 15 digits. Does anybody have any suggestions for how to get around this problem without using a different program? Here is the code:
user_num = Float(gets.chomp)
counter = 0
for num in 2...user_num
new_num = user_num/num
until counter == 1
if new_num == Integer(new_num)
puts num
counter = counter + 1
end
end
end
wikipedia FTW!!!!!
Using MuPAD: factor((2^(2^7))+1)
> 59649589127497217*5704689200685129054721
I've cheated, haven't I?
Can you explain to me the code. I don't understand and how long it takes to find the prime factor? I used linear algorithm to do this and it takes a lot of time to see the result
I can't say too much, as I've only given this a few minutes thought. But clearly it is of the form a 2 + 1 , so perhaps the best approach is to find another b 2 + c 2 representation.
Problem Loading...
Note Loading...
Set Loading...
5 9 6 4 9 5 8 9 1 2 7 4 9 7 2 1 7 × 5 7 0 4 6 8 9 2 0 0 6 8 5 1 2 9 0 5 4 7 2 1 = 3 4 0 2 8 2 3 6 6 9 2 0 9 3 8 4 6 3 4 6 3 3 7 4 6 0 7 4 3 1 7 6 8 2 1 1 4 5 7
Thats all I can say.
Here is the maxima code: