login
A124970
Smallest positive integer which can be expressed as the ordered sum of 3 squares in exactly n different ways.
2
7, 1, 9, 41, 81, 146, 194, 306, 369, 425, 594, 689, 866, 1109, 1161, 1154, 1361, 1634, 1781, 1889, 2141, 2729, 2609, 3626, 3366, 3566, 3449, 3506, 4241, 4289, 4826, 5066, 5381, 7034, 5561, 6254, 7229, 7829, 8186, 8069, 8126, 8609, 8921, 8774, 10386, 11574, 11129
OFFSET
0,1
LINKS
MATHEMATICA
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 *)
PROG
(Python)
from collections import Counter
from itertools import count, combinations_with_replacement as mc
def aupto(lim):
sq = filter(lambda x: x<=lim, (i**2 for i in range(int(lim**(1/2))+2)))
s3 = filter(lambda x: 0<x<=lim, (sum(m) for m in mc(sq, 3)))
counts, alst = Counter(s3), [7]
for n in count(1):
mink = min((k for k in counts if counts[k]==n), default=False)
if not mink: break
alst.append(mink)
return alst
print(aupto(11600)) # Michael S. Branicky, Jul 01 2021
KEYWORD
nonn
AUTHOR
Artur Jasinski, Nov 14 2006, Nov 20 2006
EXTENSIONS
Extended by Ray Chandler, Nov 30 2006
a(45) and beyond from Michael S. Branicky, Jul 01 2021
STATUS
approved