cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A362295 Sums of two Fibonacci numbers that are also sums of two squares.

This page as a plain text file.
%I A362295 #22 Sep 29 2024 06:24:04
%S A362295 0,1,2,4,5,8,9,10,13,16,18,26,29,34,36,37,58,68,89,90,97,144,145,146,
%T A362295 149,157,178,233,234,241,288,377,466,521,610,612,613,754,1000,1021,
%U A362295 1042,1076,1220,1597,1600,1602,1618,1741,2592,2597,2605,2817,3194,4181,4194,4325,6770,6773,6778,6786
%N A362295 Sums of two Fibonacci numbers that are also sums of two squares.
%C A362295 Intersection of A001481 and A084176.
%H A362295 Robert Israel, <a href="/A362295/b362295.txt">Table of n, a(n) for n = 1..2500</a>
%e A362295 a(5) = 5 is a term because 5 = 2 + 3 = A000045(3) + A000045(4) = 2^2 + 1^2.
%p A362295 ss:= proc(n) local F,t;
%p A362295   F:= ifactors(n)[2];
%p A362295   andmap(t ->  t[1] mod 4 <> 3 or t[2]::even, F)
%p A362295 end proc:
%p A362295 fibs:= map(combinat:-fibonacci, {$0..25}):
%p A362295 N:= max(fibs):
%p A362295 fib2:= {seq(seq(fibs[i]+fibs[j],i=1..j),j=1..nops(fibs))}:
%p A362295 sort(convert(select(t -> t <= N and ss(t), fib2),list));
%t A362295 max = 150; (* max = 150 gives 1670 terms *)
%t A362295 Join[{0, 1}, Select[Union[Total /@ Tuples[Fibonacci[Range[2, max]], {2}]], # <= Fibonacci[max] && SquaresR[2, #] != 0&]] (* _Jean-François Alcover_, Sep 29 2024, after _Harvey P. Dale_ in A059389 *)
%o A362295 (Python)
%o A362295 from itertools import islice
%o A362295 from sympy import factorint
%o A362295 def A362295_gen(): # generator of terms
%o A362295     yield from (0,1,2)
%o A362295     a = [1,2]
%o A362295     while True:
%o A362295         b = a[-1]+a[-2]
%o A362295         c = a[-1]<<1
%o A362295         flag = True
%o A362295         for d in a:
%o A362295             n = b+d
%o A362295             if flag and n>=c:
%o A362295                 if n>c:
%o A362295                    f = factorint(c)
%o A362295                    if all(d & 3 != 3 or f[d] & 1 == 0 for d in f):
%o A362295                        yield c
%o A362295                 flag = False
%o A362295             f = factorint(n)
%o A362295             if all(d & 3 != 3 or f[d] & 1 == 0 for d in f):
%o A362295                 yield n
%o A362295         a.append(b)
%o A362295 A362295_list = list(islice(A362295_gen(),60)) # _Chai Wah Wu_, Apr 16 2023
%Y A362295 Cf. A000045, A001481, A059389, A084176, A111378.
%K A362295 nonn
%O A362295 1,3
%A A362295 _Robert Israel_, Apr 14 2023