login
Positive integers n such that Fibonacci(n) = a^2 + b^2, where a, b are integers.
3

%I #25 May 03 2023 09:12:24

%S 1,2,3,5,6,7,9,11,12,13,14,15,17,19,21,23,25,26,27,29,31,33,35,37,38,

%T 39,41,43,45,47,49,51,53,55,57,59,61,62,63,65,67,69,71,73,74,75,77,79,

%U 81,83,85,86,87,89,91,93,95,97,98,99,101,103,105,107,109,111,113,115,117,119,121,122,123,125,127

%N Positive integers n such that Fibonacci(n) = a^2 + b^2, where a, b are integers.

%C All odd numbers are in this sequence, since the Fibonacci number with index 2m+1 is the sum of the squares of the two Fibonacci numbers with indices m and m+1. Those with even indices ultimately depend on certain Lucas numbers being the sum of two squares (see A124132). Joint work with Kevin O'Bryant and Dennis Eichhorn.

%C Numbers n such that Fibonacci(n) or Fibonacci(n)/2 is a square are only 0, 1, 2, 3, 6, 12. So a and b must be distinct and nonzero for all values of this sequence except 1, 2, 3, 6, 12. - _Altug Alkan_, May 04 2016

%H Chai Wah Wu, <a href="/A124134/b124134.txt">Table of n, a(n) for n = 1..1322</a> (terms 1..210 from Joerg Arndt)

%F Intersection of A000045 and A001481.

%F A000161(A000045(a(n))) > 0. - _Reinhard Zumkeller_, Oct 10 2013

%e 14 is in the sequence because F_14=377=11^2+16^2.

%e 16 is not in the sequence because F_16=987 is congruent to 3 (mod 4).

%t Select[Range@ 128, SquaresR[2, Fibonacci@ #] > 0 &] (* _Michael De Vlieger_, May 04 2016 *)

%o (PARI) for(n=1, 10^6, t=fibonacci(n); s=sqrtint(t); forstep(i=s, 1, -1, if(issquare(t-i*i), print1(n, ", "); break))) \\ _Ralf Stephan_, Sep 15 2013

%o (PARI) is2s(n)={my(f=factor(n)); for(i=1, #f[, 1], if(f[i, 2]%2 && f[i, 1]%4==3, return(0))); 1; } \\ see A001481

%o for(n=1, 10^6, if(is2s(fibonacci(n)), print1(n, ", "))); \\ _Joerg Arndt_, Sep 15 2013

%o (Haskell)

%o a124134 n = a124134_list !! (n-1)

%o a124134_list = filter ((> 0) . a000161 . a000045) [1..]

%o -- _Reinhard Zumkeller_, Oct 10 2013

%o (Python)

%o from itertools import count, islice

%o from sympy import factorint, fibonacci

%o def A124134_gen(): # generator of terms

%o return filter(lambda n:n & 1 or all(p & 3 != 3 or e & 1 == 0 for p, e in factorint(fibonacci(n)).items()),count(1))

%o A124134_list = list(islice(A124134_gen(),30)) # _Chai Wah Wu_, Jun 27 2022

%Y Cf. A124132, A000045, A000161, A001481.

%K nonn

%O 1,2

%A Melvin J. Knight (melknightdr(AT)verizon.net), Nov 30 2006

%E More terms from _Ralf Stephan_, Sep 15 2013