A004215 Numbers that are the sum of 4 but no fewer nonzero squares.
7, 15, 23, 28, 31, 39, 47, 55, 60, 63, 71, 79, 87, 92, 95, 103, 111, 112, 119, 124, 127, 135, 143, 151, 156, 159, 167, 175, 183, 188, 191, 199, 207, 215, 220, 223, 231, 239, 240, 247, 252, 255, 263, 271, 279, 284, 287, 295, 303, 311, 316, 319, 327, 335, 343
Offset: 1
Examples
15 is in the sequence because it is the sum of four squares, namely, 3^2 + 2^2 + 1^2 + 1^2, and it can't be expressed as the sum of fewer squares. 16 is not in the sequence, because, although it can be expressed as 2^2 + 2^2 + 2^2 + 2^2, it can also be expressed as 4^2.
References
- L. E. Dickson, History of the Theory of Numbers. Carnegie Institute Public. 256, Washington, DC, Vol. 1, 1919; Vol. 2, 1920; Vol. 3, 1923, see vol. 2, p. 261.
- G. H. Hardy, Ramanujan: twelve lectures on subjects suggested by his life and work, Cambridge, University Press, 1940, p. 12.
- E. Poznanski, 1901. Pierwiastki pierwotne liczb pierwszych. Warszawa, pp. 1-63.
- W. Sierpiński, 1925. Teorja Liczb. pp. 1-410 (p. 125).
- N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
- David Wells, The Penguin Dictionary of Curious and Interesting Numbers, entry 4181.
Links
- T. D. Noe, Table of n, a(n) for n = 1..10000
- David S. Bettes, Letter to N. J. A. Sloane, Nov 05 1976
- Richard T. Bumby, Sums Of Four Squares
- International Union of Crystallography, Cubic structures.
- Shuo Li, The characteristic sequence of the integers that are the sum of two squares is not morphic, arXiv:2404.08822 [math.NT], 2024.
- Louis J. Mordell, A new Waring's problem with squares of linear forms, Quart. J. Math., 1 (1930), 276-288 (see p. 283).
- Saburô Uchiyama, A five-square theorem, Publ. Res. Math. Sci., Vol 13, Number 1 (1977), 301-305.
- Steve Waterman, Missing numbers formula
- Eric Weisstein's World of Mathematics, Square Number
- Wikipedia, Lagrange's four-square theorem.
- Index entries for sequences related to sums of squares
Crossrefs
Programs
-
Haskell
a004215 n = a004215_list !! (n-1) a004215_list = filter ((== 4) . a002828) [1..] -- Reinhard Zumkeller, Feb 26 2015
-
Maple
N:= 1000: # to get all terms <= N {seq(seq(4^i * (8*j + 7), j = 0 .. floor((N/4^i - 7)/8)), i = 0 .. floor(log[4](N)))}; # Robert Israel, Sep 02 2014
-
Mathematica
Sort[Flatten[Table[4^i(8j + 7), {i, 0, 2}, {j, 0, 42}]]] (* Alonso del Arte, Jul 05 2005 *) Select[Range[120], Mod[ #/4^IntegerExponent[ #, 4], 8] == 7 &] (* Ant King, Oct 14 2010 *)
-
PARI
isA004215(n)={ local(fouri,j) ; fouri=1 ; while( n >=7*fouri, if( n % fouri ==0, j= n/fouri -7 ; if( j % 8 ==0, return(1) ) ; ) ; fouri *= 4 ; ) ; return(0) ; } { for(n=1,400, if(isA004215(n), print1(n,",") ; ) ; ) ; } \\ R. J. Mathar, Nov 22 2006
-
PARI
isA004215(n)= n\4^valuation(n,4)%8==7 \\ M. F. Hasler, Mar 18 2011
-
Python
def valuation(n, b): v = 0 while n > 1 and n%b == 0: n //= b; v += 1 return v def ok(n): return n//4**valuation(n, 4)%8 == 7 # after M. F. Hasler print(list(filter(ok, range(344)))) # Michael S. Branicky, Jul 15 2021
-
Python
from itertools import count, islice def A004215_gen(startvalue=1): # generator of terms >= startvalue return filter(lambda n:not (m:=(~n&n-1).bit_length())&1 and (n>>m)&7==7,count(max(startvalue,1))) A004215_list = list(islice(A004215_gen(),30)) # Chai Wah Wu, Jul 09 2022
-
Python
def A004215(n): def bisection(f,kmin=0,kmax=1): while f(kmax) > kmax: kmax <<= 1 kmin = kmax >> 1 while kmax-kmin > 1: kmid = kmax+kmin>>1 if f(kmid) <= kmid: kmax = kmid else: kmin = kmid return kmax def f(x): return n+x-sum(((x>>(i<<1))-7>>3)+1 for i in range(x.bit_length()>>1)) return bisection(f,n,n) # Chai Wah Wu, Feb 14 2025
Formula
a(n) = A055039(n)/2. - Ray Chandler, Jan 30 2009
Numbers of the form 4^i*(8*j+7), i >= 0, j >= 0. [A.-M. Legendre & C. F. Gauss]
a(n) = 6*n + O(log(n)). - Charles R Greathouse IV, Dec 19 2013
Conjecture: The number of terms < 2^n is A023105(n) - 2. - Tilman Neumann, Sep 20 2020
Extensions
More terms from Arlin Anderson (starship1(AT)gmail.com)
Additional comments from Jud McCranie, Mar 19 2000
Comments