# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/ Search: id:a103266 Showing 1-1 of 1 %I A103266 #20 Nov 21 2018 03:18:07 %S A103266 1,2,3,2,2,2,3,2,4,2,1,2,2,2,3,2,3,2,3,2,4,2,3,2,2,2,3,2,3,2,3,2,4,2, %T A103266 3,2,2,2,3,2,3,2,3,2,4,2,3,2,3,2,3,2,3,2,3,2,4,2,3,2,2,2,3,2,3,2,3,2, %U A103266 4,2,3,2,2,2,3,2,3,2,3,2,4,2,4,2,2,2,3,2,3,2,3,2,4,2,3,2,2,2,3,2,3,2,3,2,4 %N A103266 Minimal number of squares needed to sum to Fibonacci(n+1). %C A103266 Since every positive integer is the sum of four squares, no term is greater than 4. Also, since any positive integer not of the form 4^k(8m+7) is the sum 3 or fewer squares, the next occurrences of a(n)=4 are at n = 45, 57, 69, 81, 83, 93, .... - _John W. Layman_, Mar 30 2005 %D A103266 Hardy and Wright, An Introduction to the Theory of Numbers, Fourth Ed., Oxford, Section 20.10. %H A103266 Hans Havermann, Table of n, a(n) for n = 1..1400 (terms 1..465 from Antti Karttunen) %F A103266 a(n) = A002828(A000045(n+1)). %e A103266 Fibonacci(10+1) = 89 = 25+64, so a(10)=2. %t A103266 Array[If[First[#] > 0, 1, Length@ First@ Split@ # + 1] &@ SquaresR[Range@ 4, Fibonacci@ #] &, 50, 2] (* _Michael De Vlieger_, Nov 13 2018, after _Harvey P. Dale_ at A002828 *) %o A103266 (PARI) %o A103266 istwo(n:int) = { my(f); if(n<3, return(n>=0); ); f=factor(n>>valuation(n, 2)); for(i=1, #f[, 1], if(bitand(f[i, 2], 1)==1&&bitand(f[i, 1], 3)==3, return(0))); 1 }; %o A103266 isthree(n:int) = { my(tmp=valuation(n, 2)); bitand(tmp, 1)||bitand(n>>tmp, 7)!=7 }; %o A103266 A002828(n) = if(issquare(n), !!n, if(istwo(n), 2, 4-isthree(n))); \\ From A002828 %o A103266 A103266(n) = A002828(fibonacci(1+n)); \\ _Antti Karttunen_, Nov 10 2018 %Y A103266 Cf. A000045, A002828. %K A103266 nonn %O A103266 1,2 %A A103266 _Giovanni Teofilatto_, Mar 20 2005 %E A103266 Corrected and extended by _John W. Layman_, Mar 30 2005 %E A103266 Extended by _Ray Chandler_, May 16 2005 # Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE