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!)
A000414 Numbers that are the sum of 4 nonzero squares. 51

%I #35 Jul 10 2022 03:57:44

%S 4,7,10,12,13,15,16,18,19,20,21,22,23,25,26,27,28,30,31,33,34,35,36,

%T 37,38,39,40,42,43,44,45,46,47,48,49,50,51,52,53,54,55,57,58,59,60,61,

%U 62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81

%N Numbers that are the sum of 4 nonzero squares.

%C As the order of addition doesn't matter we can assume terms are in increasing order. - _David A. Corneth_, Aug 01 2020

%H David A. Corneth, <a href="/A000414/b000414.txt">Table of n, a(n) for n = 1..10000</a> (first 1000 terms from T. D. Noe)

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

%F a(n) = n + O(log n). - _Charles R Greathouse IV_, Sep 03 2014

%e From _David A. Corneth_, Aug 01 2020: (Start)

%e 1608 is in the sequence as 1608 = 18^2 + 20^2 + 20^2 + 22^2.

%e 2140 is in the sequence as 2140 = 21^2 + 21^2 + 23^2 + 27^2.

%e 3298 is in the sequence as 3298 = 25^2 + 26^2 + 29^2 + 34^2. (End)

%t q=16;lst={};Do[Do[Do[Do[z=a^2+b^2+c^2+d^2;If[z<=(q^2)+3,AppendTo[lst,z]],{d,q}],{c,q}],{b,q}],{a,q}];Union@lst (*_Vladimir Joseph Stephan Orlovsky_, Feb 07 2010 *)

%o (PARI) is(n)=my(k=if(n,n/4^valuation(n,4),2)); k!=2 && k!=6 && k!=14 && !setsearch([0, 1, 3, 5, 9, 11, 17, 29, 41], n) \\ _Charles R Greathouse IV_, Sep 03 2014

%o (Python)

%o limit = 10026 # 10000th term in b-file

%o from functools import lru_cache

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

%o nzss = set(nzs)

%o @lru_cache(maxsize=None)

%o def ok(n, m): return n in nzss if m == 1 else any(ok(n-s, m-1) for s in nzs)

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

%o (Python)

%o from itertools import count, islice

%o def A000414_gen(startvalue=0): # generator of terms >= startvalue

%o return filter(lambda n:not(n in {0, 1, 3, 5, 9, 11, 17, 29, 41} or n>>((~n&n-1).bit_length()&-2) in {2,6,14}),count(max(startvalue,0)))

%o A000414_list = list(islice(A000414_gen(),30)) # _Chai Wah Wu_, Jul 09 2022

%Y Cf. A000534 (complement).

%Y A###### (x, y): Numbers that are the form of x nonzero y-th powers.

%Y Cf. A000404 (2, 2), A000408 (3, 2), A000414 (4, 2), A003072 (3, 3), A003325 (3, 2), A003327 (4, 3), A003328 (5, 3), A003329 (6, 3), A003330 (7, 3), A003331 (8, 3), A003332 (9, 3), A003333 (10, 3), A003334 (11, 3), A003335 (12, 3), A003336 (2, 4), A003337 (3, 4), A003338 (4, 4), A003339 (5, 4), A003340 (6, 4), A003341 (7, 4), A003342 (8, 4), A003343 (9, 4), A003344 (10, 4), A003345 (11, 4), A003346 (12, 4), A003347 (2, 5), A003348 (3, 5), A003349 (4, 5), A003350 (5, 5), A003351 (6, 5), A003352 (7, 5), A003353 (8, 5), A003354 (9, 5), A003355 (10, 5), A003356 (11, 5), A003357 (12, 5), A003358 (2, 6), A003359 (3, 6), A003360 (4, 6), A003361 (5, 6), A003362 (6, 6), A003363 (7, 6), A003364 (8, 6), A003365 (9, 6), A003366 (10, 6), A003367 (11, 6), A003368 (12, 6), A003369 (2, 7), A003370 (3, 7), A003371 (4, 7), A003372 (5, 7), A003373 (6, 7), A003374 (7, 7), A003375 (8, 7), A003376 (9, 7), A003377 (10, 7), A003378 (11, 7), A003379 (12, 7), A003380 (2, 8), A003381 (3, 8), A003382 (4, 8), A003383 (5, 8), A003384 (6, 8), A003385 (7, 8), A003387 (9, 8), A003388 (10, 8), A003389 (11, 8), A003390 (12, 8), A003391 (2, 9), A003392 (3, 9), A003393 (4, 9), A003394 (5, 9), A003395 (6, 9), A003396 (7, 9), A003397 (8, 9), A003398 (9, 9), A003399 (10, 9), A004800 (11, 9), A004801 (12, 9), A004802 (2, 10), A004803 (3, 10), A004804 (4, 10), A004805 (5, 10), A004806 (6, 10), A004807 (7, 10), A004808 (8, 10), A004809 (9, 10), A004810 (10, 10), A004811 (11, 10), A004812 (12, 10), A004813 (2, 11), A004814 (3, 11), A004815 (4, 11), A004816 (5, 11), A004817 (6, 11), A004818 (7, 11), A004819 (8, 11), A004820 (9, 11), A004821 (10, 11), A004822 (11, 11), A004823 (12, 11), A047700 (5, 2).

%K nonn,easy

%O 1,1

%A _N. J. A. Sloane_ and _J. H. Conway_

%E corrected 6/95

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 25 11:30 EDT 2024. Contains 371967 sequences. (Running on oeis4.)