%I #16 Jul 01 2021 12:12:46
%S 7,1,9,41,81,146,194,306,369,425,594,689,866,1109,1161,1154,1361,1634,
%T 1781,1889,2141,2729,2609,3626,3366,3566,3449,3506,4241,4289,4826,
%U 5066,5381,7034,5561,6254,7229,7829,8186,8069,8126,8609,8921,8774,10386,11574,11129
%N Smallest positive integer which can be expressed as the ordered sum of 3 squares in exactly n different ways.
%H Michael S. Branicky, <a href="/A124970/b124970.txt">Table of n, a(n) for n = 0..2102</a>
%t f[n_] := Block[{k = 1}, While[Length@PowersRepresentations[k, 3, 2] != n, k++]; k]; Table[f[n], {n, 0, 44}] (* _Ray Chandler_, Oct 31 2019 *)
%o (Python)
%o from collections import Counter
%o from itertools import count, combinations_with_replacement as mc
%o def aupto(lim):
%o sq = filter(lambda x: x<=lim, (i**2 for i in range(int(lim**(1/2))+2)))
%o s3 = filter(lambda x: 0<x<=lim, (sum(m) for m in mc(sq, 3)))
%o counts, alst = Counter(s3), [7]
%o for n in count(1):
%o mink = min((k for k in counts if counts[k]==n), default=False)
%o if not mink: break
%o alst.append(mink)
%o return alst
%o print(aupto(11600)) # _Michael S. Branicky_, Jul 01 2021
%Y Cf. A000451, A095809, A000437, A122699, A124966-A124971.
%K nonn
%O 0,1
%A _Artur Jasinski_, Nov 14 2006, Nov 20 2006
%E Extended by _Ray Chandler_, Nov 30 2006
%E a(45) and beyond from _Michael S. Branicky_, Jul 01 2021
|