login
Least k such that Fibonacci(n) + Fibonacci(n+1) + ... + Fibonacci(n+k-1) is prime.
2

%I #19 Aug 26 2012 11:27:14

%S 3,2,2,1,1,1,5,1,4,2,4,1,5,1,4,2,4,1,5,7,29,2,37,1,11,163,5,2,4,1,5,

%T 73,19,1433,4,13,347,61201,4,47,43,2,41,1,4,2,13,1,131,19,4,5,7,787,

%U 173,31,13,1265,4,11,53

%N Least k such that Fibonacci(n) + Fibonacci(n+1) + ... + Fibonacci(n+k-1) is prime.

%C Next term, if it exists, is bigger than 95000.

%e 0+1+1=2, three summands, so a(0)=3,

%e 1+1=2, two summands,

%e 1+2=3, two summands,

%e 2,

%e 3,

%e 5,

%e 8+13+21+34+55=131, five summands, so a(6)=5, and so on.

%t Table[k = n; p = Fibonacci[k]; While[! PrimeQ[p], k++; p = p + Fibonacci[k]]; k - n + 1, {n, 0, 30}] (* _T. D. Noe_, Jul 30 2012 *)

%o (Java)

%o import static java.lang.System.out;

%o import java.math.BigInteger;

%o public class A214878 {

%o public static void main (String[] args) {

%o BigInteger prpr=BigInteger.ZERO, prpr0;

%o BigInteger prev=BigInteger.ONE, prev0, curr, sum, prevSum;

%o long i, n;

%o for (n=0; ; ++n) {

%o prpr0 = prpr;

%o prev0 = prev;

%o sum = BigInteger.ZERO;

%o for (i=n; ; ++i) {

%o sum = sum.add(prpr);

%o if (sum.isProbablePrime(2)) {

%o if (sum.isProbablePrime(80)) break;

%o }

%o curr = prev.add(prpr);

%o prpr = prev;

%o prev = curr;

%o }

%o out.printf("%d, ", i+1-n);

%o prpr = prev0;

%o prev = prev0.add(prpr0);

%o }

%o }

%o }

%Y Cf. A000040, A000045, A214874.

%K nonn,hard,more

%O 0,1

%A _Alex Ratushnyak_, Jul 29 2012

%E a(37)-a(60) from _T. D. Noe_, Jul 30 2012