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.

A003338 Numbers that are the sum of 4 nonzero 4th powers.

This page as a plain text file.
%I A003338 #43 Feb 16 2025 08:32:27
%S A003338 4,19,34,49,64,84,99,114,129,164,179,194,244,259,274,289,304,324,339,
%T A003338 354,369,419,434,499,514,529,544,594,609,628,643,658,673,674,708,723,
%U A003338 738,769,784,788,803,849,868,883,898,913,963,978,1024,1043,1138,1153,1218
%N A003338 Numbers that are the sum of 4 nonzero 4th powers.
%C A003338 As the order of addition doesn't matter we can assume terms are in nondecreasing order. - _David A. Corneth_, Aug 01 2020
%H A003338 David A. Corneth, <a href="/A003338/b003338.txt">Table of n, a(n) for n = 1..10000</a> (first 1000 terms from T. D. Noe)
%H A003338 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/BiquadraticNumber.html">Biquadratic Number.</a>
%e A003338 From _David A. Corneth_, Aug 01 2020: (Start)
%e A003338 53667 is in the sequence as 53667 = 2^4 + 5^4 + 7^4 + 15^4.
%e A003338 81427 is in the sequence as 81427 = 5^4 + 5^4 + 11^4 + 16^4.
%e A003338 106307 is in the sequence as 106307 = 3^4 + 5^4 + 5^4 + 18^4. (End)
%p A003338 # returns number of ways of writing n as a^4+b^4+c^4+d^4, 1<=a<=b<=c<=d.
%p A003338 A003338 := proc(n)
%p A003338     local a,i,j,k,l,res ;
%p A003338     a := 0 ;
%p A003338     for i from 1 do
%p A003338         if i^4 > n then
%p A003338             break ;
%p A003338         end if;
%p A003338         for j from i do
%p A003338             if i^4+j^4 > n then
%p A003338                 break ;
%p A003338             end if;
%p A003338             for k from j do
%p A003338                 if i^4+j^4+k^4> n then
%p A003338                     break;
%p A003338                 end if;
%p A003338                 res := n-i^4-j^4-k^4 ;
%p A003338                 if issqr(res) then
%p A003338                     res := sqrt(res) ;
%p A003338                     if issqr(res) then
%p A003338                         l := sqrt(res) ;
%p A003338                         if l >= k then
%p A003338                             a := a+1 ;
%p A003338                         end if;
%p A003338                     end if;
%p A003338                 end if;
%p A003338             end do:
%p A003338         end do:
%p A003338     end do:
%p A003338     a ;
%p A003338 end proc:
%p A003338 for n from 1 do
%p A003338     if A003338(n) > 0 then
%p A003338         print(n) ;
%p A003338     end if;
%p A003338 end do: # _R. J. Mathar_, May 17 2023
%t A003338 f[maxno_]:=Module[{nn=Floor[Power[maxno-3, 1/4]],seq}, seq=Union[Total/@(Tuples[Range[nn],{4}]^4)]; Select[seq,#<=maxno&]]
%t A003338 f[1000] (* _Harvey P. Dale_, Feb 27 2011 *)
%o A003338 (Python)
%o A003338 limit = 1218
%o A003338 from functools import lru_cache
%o A003338 qd = [k**4 for k in range(1, int(limit**.25)+2) if k**4 + 3 <= limit]
%o A003338 qds = set(qd)
%o A003338 @lru_cache(maxsize=None)
%o A003338 def findsums(n, m):
%o A003338   if m == 1: return {(n, )} if n in qds else set()
%o A003338   return set(tuple(sorted(t+(q,))) for q in qds for t in findsums(n-q, m-1))
%o A003338 print([n for n in range(4, limit+1) if len(findsums(n, 4)) >= 1]) # _Michael S. Branicky_, Apr 19 2021
%Y A003338 Cf. A047715, A309763 (more than 1 way), A344189 (exactly 2 ways), A176197 (distinct nonzero powers).
%Y A003338 A###### (x, y): Numbers that are the form of x nonzero y-th powers.
%Y A003338 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 A003338 nonn,easy
%O A003338 1,1
%A A003338 _N. J. A. Sloane_