Skip to main content
edited tags; edited tags
Link
200_success
  • 144.1k
  • 22
  • 188
  • 473
added 46 characters in body; edited tags
Source Link
Jamal
  • 34.9k
  • 13
  • 133
  • 237

I tested it for first 107 natural numbers, also for first 1000 fibonacciFibonacci numbers - and it seems conjecture is true. but I takes a lot of time (80-90 seconds) to spit out a result.

My question is:

How can this code can be written in an optimal way, for faster results? Or, which techniques should I follow (either within the code or within the math)?

$ python timings.py 0 1000
[]
0.0163550376892
$ python timings.py 1000 2000
[]
0.0392298698425
$ python timings.py 2000 12000
[]
1.66012907028
$ python timings.py 12000 42000
[]
35.4742548466
$ python timings.py 42000 43000
[]
2.01177597046
$ python timings.py 43000 48000
[]
11.1937119961
$ python timings.py 0 1000
[]
0.0163550376892
$ python timings.py 1000 2000
[]
0.0392298698425
$ python timings.py 2000 12000
[]
1.66012907028
$ python timings.py 12000 42000
[]
35.4742548466
$ python timings.py 42000 43000
[]
2.01177597046
$ python timings.py 43000 48000
[]
11.1937119961

I tested it for first 107 natural numbers, also for first 1000 fibonacci numbers - and it seems conjecture is true. but I takes a lot of time (80-90 seconds) to spit out a result.

My question is:

How this code can be written in an optimal way, for faster results? Or, which techniques should I follow (either within the code or within the math)?

$ python timings.py 0 1000
[]
0.0163550376892
$ python timings.py 1000 2000
[]
0.0392298698425
$ python timings.py 2000 12000
[]
1.66012907028
$ python timings.py 12000 42000
[]
35.4742548466
$ python timings.py 42000 43000
[]
2.01177597046
$ python timings.py 43000 48000
[]
11.1937119961

I tested it for first 107 natural numbers, also for first 1000 Fibonacci numbers - and it seems conjecture is true. but I takes a lot of time (80-90 seconds) to spit out a result.

How can this code be written in an optimal way, for faster results? Or, which techniques should I follow (either within the code or within the math)?

$ python timings.py 0 1000
[]
0.0163550376892
$ python timings.py 1000 2000
[]
0.0392298698425
$ python timings.py 2000 12000
[]
1.66012907028
$ python timings.py 12000 42000
[]
35.4742548466
$ python timings.py 42000 43000
[]
2.01177597046
$ python timings.py 43000 48000
[]
11.1937119961
fixed code blocks, spelling, title; Preserves original quoted source material & command-line session
Source Link
bisserlis
  • 3.3k
  • 1
  • 12
  • 17

The sequence of Fibonacci numbers is defined as F1 = 1, Fn = Fn−2 + Fn−1. It has been conjectured that for any Fibonacci number F, F2 + 41 is composite.

... [T]ask is to either prove the conjecture to be true or find a counter-example that demonstrates it is false. source

(source)

Here is my working code for this problem - although I don't know the conjecture is either true or false in general.

$ python timings.py 0 1000

0.0163550376892

[]
0.0163550376892
$ python timings.py 1000 2000

0.0392298698425

[]
0.0392298698425
$ python timings.py 2000 12000

1.66012907028

[]
1.66012907028
$ python timings.py 12000 42000

35.4742548466

[]
35.4742548466
$ python timings.py 42000 43000

2.01177597046

[]
2.01177597046
$ python timings.py 43000 48000
[]
11.1937119961

11.1937119961

The sequence of Fibonacci numbers is defined as F1 = 1, Fn = Fn−2 + Fn−1. It has been conjectured that for any Fibonacci number F, F2 + 41 is composite.

... [T]ask is to either prove the conjecture to be true or find a counter-example that demonstrates it is false. source

Here is my working code for this problem - although I don't know the conjecture is either true or false in general.

$ python timings.py 0 1000

0.0163550376892

$ python timings.py 1000 2000

0.0392298698425

$ python timings.py 2000 12000

1.66012907028

$ python timings.py 12000 42000

35.4742548466

$ python timings.py 42000 43000

2.01177597046

$ python timings.py 43000 48000

11.1937119961

The sequence of Fibonacci numbers is defined as F1 = 1, Fn = Fn−2 + Fn−1. It has been conjectured that for any Fibonacci number F, F2 + 41 is composite.

... [T]ask is to either prove the conjecture to be true or find a counter-example that demonstrates it is false.

(source)

Here is my working code for this problem - although I don't know the conjecture is either true or false in general.

$ python timings.py 0 1000
[]
0.0163550376892
$ python timings.py 1000 2000
[]
0.0392298698425
$ python timings.py 2000 12000
[]
1.66012907028
$ python timings.py 12000 42000
[]
35.4742548466
$ python timings.py 42000 43000
[]
2.01177597046
$ python timings.py 43000 48000
[]
11.1937119961
Loading
Source Link
Loading