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.

A100876 Least number of squares that sum to prime(n).

This page as a plain text file.
%I A100876 #9 Aug 03 2014 14:01:21
%S A100876 2,3,2,4,3,2,2,3,4,2,4,2,2,3,4,2,3,2,3,4,2,4,3,2,2,2,4,3,2,2,4,3,2,3,
%T A100876 2,4,2,3,4,2,3,2,4,2,2,4,3,4,3,2,2,4,2,3,2,4,2,4,2,2,3,2,3,4,2,2,3,2,
%U A100876 3,2,2,4,4,2,3,4,2,2,2,2,3,2,4,2,4,3,2,2,2,4,3,4,4,3,3,4,2,2,3,2,3,2,3,2,3
%N A100876 Least number of squares that sum to prime(n).
%C A100876 Note that a(n) <= 4 by Lagrange's four-square theorem. - _T. D. Noe_, Jan 10 2005
%C A100876 Primes 2 and 4k+1 (A002313) require only 2 positive squares; primes 8k+3 (A007520) require 3 positive squares; primes 8k+7 (A007522) require 4 positive squares.
%F A100876 a(n) = A002828(prime(n)) - _T. D. Noe_, Jan 10 2005
%e A100876 a(2)=3 because 3=1^2+1^2+1^2;
%e A100876 a(3)=2 because 5=1^2+2^2;
%e A100876 a(4)=4 because 7=2^2+1^2+1^2+1^2.
%t A100876 SquareCnt[n_] := If[SquaresR[1, n] > 0, 1, If[SquaresR[2, n] > 0, 2, If[SquaresR[3, n] > 0, 3, 4]]]; Table[p = Prime[n]; SquareCnt[p], {n, 150}] (* _T. D. Noe_, Jan 10 2005, revised Sep 27 2011 *)
%Y A100876 Cf. A002828 (least number of squares needed to represent n).
%K A100876 nonn
%O A100876 1,1
%A A100876 _Giovanni Teofilatto_, Jan 09 2005
%E A100876 More terms from _T. D. Noe_, Jan 10 2005