Hi everyone.
I recently became interested in A000057 (primes dividing all Fibonacci sequences), and tried to improve the b-file. My first attempt was really slow, as I was doing a test that was taking a time proportional to k^2. Then I realized that the program by Charles Greathouse, which I rewrote in C because I don't speak PARI, was really fast since the test takes a time that is proportional to k instead of k^2. So it was easy to boost the b-file to 10000 terms.
Then I realized that A000057 is just a subsequence of A064414, which should probably be renamed just "Numbers dividing all Fibonacci sequences". However the test that worked for A000057 doesn't work for A064414. The composite numbers need a test that takes a time proportional to k^2. However, to get more terms, we can be smart about it:
- We can separate primes from composite numbers and use the fast test on the primes, and the slow test on the composite numbers.
- If a number doesn't divide all fibonacci sequences, then neither do any of its multiples. So, as we are done processing each number, we can update a sieve to eliminate all the future numbers that we know can't be in the sequence.
- and lastly, except for numbers that are being eliminated in a sieve, each new number in the sequence doesn't depend on previous numbers. So we take advantage of today's newer computers having multiple cores, and have each core process a different number in parallel.
So I have been experimenting with multi-threaded programming. After many trial and errors, I was able to get 10000 terms for A064414 on a 4-core computer in 7.5 days. Then I reran a slightly modified version of this program on a 32-core computer and got the same result in less than 8 hours (about 24 times faster).
Of course my program is much more complicated than a single-thread version. Not only the next number needs to be assigned (without duplication) to each thread as they finish their previous task, but the time it takes for each test to complete varies wildly, so a single thread is responsible to collect all the results, and is responsible to display them in the right order. I may be wrong, but I don't believe that programs written in PARI or Mathematica could take advantage of multithreading.
Now that I have 10000 terms for both A000057 and A064414, I can do some analysis.
We already know that except for 2, all terms of A000057 are congruent to 3 or 7 modulo 20, but what about A064414?
It turns out that there are some interesting patterns, for instance:
- if you look at the terms modulo 20, most terms are congruent to 3,6,7 and 14. Exceptions are at 1,2,4, 9, and 18. None of them are congruent to 5, 10,11,12,13,15,16,17 or 19.
- if you look at the terms modulo 24, most terms are congruent to 7,11,14, 19 and 23. Exceptions are at 1,2,3, 4, 6, and 9. None of them are congruent to 5, 8, 10, 12, 13, 15, 16, 17, 18, 20, 21 or 22.
Also, almost none of them are multiple of 3 or7.
Now if you look at the composite numbers of A064414 only, the sequence begins 1, 4, 6, 9, 14, 27, 49, 81, 86, 98, etc... and contains a lot of powers.
Then take the first difference of these numbers modulo 24, and you get this:
You can probably see a horizontal symmetry around 12, and a solid line at the bottom.
That means that:
- Most numbers are multiple of 24.
- The exceptions are relatively rare.
- None of them are congruent to 1, 4, 6, 10, 14, 16, 18, 20, 21, or 23 mod 24.
- And with the exceptions of 4, 9, 27 and 81, all exceptions are located between 2 multiples of 24, there appears to be no double exceptions back to back.
Now, I currently only have about 3000 terms, so there might still be more exceptions further down the sequence.
We can also look at the first difference of the composite terms of A064414 modulo other values. For instance, the graph for modulo 17 is curious:
Some values seem a lot more rare than others, for no obvious reasons.
Similar graphs for 41, 47, etc...
General questions:
Would it be worth having 5 new sequences:
1) The composite numbers of A064414 (I currently have about 3000 terms, hoping to get 10000 by the end of the week).
2) The first differences of A064414,
3) The first differences of its prime terms (A000057),
4) The first difference of its composite terms (new sequence (1)) ?
5) And since about 3/4 of the terms of A064414 are prime, and most of what remains are multiple of 24, we could have a sequence with just the remaining exceptions: the terms of A064414 that are neither primes or multiple of 24.
PS: I have uploaded new 10000 terms b-files for A000057 and A064414, but have not submitted them in case I need to make some additional changes to the comments.
Daniel.