login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A025357 Numbers that are the sum of 4 nonzero squares in exactly 1 way. 14

%I #33 Apr 07 2021 14:55:51

%S 4,7,10,12,13,15,16,18,19,20,21,22,23,25,26,27,30,33,35,38,40,44,46,

%T 48,51,53,59,62,64,65,72,80,88,89,101,104,120,152,160,176,184,192,248,

%U 256,288,320,352,416,480,608,640,704,736,768,992,1024,1152,1280,1408,1664

%N Numbers that are the sum of 4 nonzero squares in exactly 1 way.

%H Michael S. Branicky, <a href="/A025357/b025357.txt">Table of n, a(n) for n = 1..138</a> (terms 1..95 from Robert Price)

%H Michael S. Branicky, <a href="/A025357/a025357.py.txt">Python program</a>

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/SquareNumber.html">Square Number.</a>

%H <a href="/index/Su#ssq">Index entries for sequences related to sums of squares</a>

%F {n: A025428(n) = 1}. - _R. J. Mathar_, Jun 15 2018

%F A243148(a(n),4) = 1. - _Alois P. Heinz_, Feb 25 2019

%t selQ[n_] := Length[ Select[ PowersRepresentations[n, 4, 2], Times @@ # != 0 &]] == 1; Reap[Do[If[selQ[n], Print[n]; Sow[n]], {n, 1, 2000}]][[2, 1]] (* _Jean-François Alcover_, Oct 03 2013 *)

%t b[n_, i_, k_, t_] := b[n, i, k, t] = If[n == 0, If[t == 0, 1, 0], If[i<1 || t<1, 0, b[n, i - 1, k, t] + If[i^2 > n, 0, b[n - i^2, i, k, t - 1]]]];

%t T[n_, k_] := b[n, Sqrt[n] // Floor, k, k];

%t Position[Table[T[n, 4], {n, 0, 2000}], 1] - 1 // Flatten (* _Jean-François Alcover_, Nov 06 2020, after _Alois P. Heinz_ in A243148 *)

%o (Python) # see link for faster version

%o limit = 1664

%o from functools import lru_cache

%o sq = [k*k for k in range(1, int(limit**.5)+2) if k*k + 3 <= limit]

%o sqs = set(sq)

%o @lru_cache(maxsize=None)

%o def findsums(n, m):

%o if m == 1: return {(n,)} if n in sqs else set()

%o return set(tuple(sorted(t+(s, ))) for s in sq for t in findsums(n-s, m-1))

%o print([n for n in range(4, limit+1) if len(findsums(n, 4)) == 1]) # _Michael S. Branicky_, Apr 07 2021

%Y Cf. A025428, A243148.

%K nonn

%O 1,1

%A _David W. Wilson_

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 04:35 EDT 2024. Contains 371782 sequences. (Running on oeis4.)