A379857 Number of values of k for which n can be written as a sum of k distinct positive squares.
1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 1, 0, 0, 2, 2, 0, 0, 2, 3, 1, 1, 2, 2, 1, 1, 1, 1, 1, 0, 2, 2, 1, 1, 3, 3, 0, 1, 1, 2, 1, 0, 1, 3, 3, 0, 1, 2, 2, 1, 3, 2, 1, 2
Offset: 0
Examples
a(0) = 1, as it is the sum of 0 squares. a(25) = 2, as 25 = 5^2 = 4^2 + 3^2, so k can be 1 or 2. a(90) = 4, as 90 = 9^2 + 3^2 = 8^2 + 5^2 + 1^2 = 8^2 + 4^2 + 3^2 + 1^2 = 6^2 + 5^2 + 4^2 + 3^2 + 2^2, so k can be 2, 3, 4 or 5.
Links
- Luke E. Holland, Table of n, a(n) for n = 0..10000
- Paul T. Bateman, Adolf J. Hildebrand, and George B. Purdy, Sums of distinct squares, Acta Arithmetica 67 (1994), pp. 349-380.
Crossrefs
Programs
-
Python
MAXSQUARE = 500 possibleSums = {i: [[], []] for i in range(MAXSQUARE ** 2 + 1)} possibleSums[0] = [[0],[0]] for val in range(MAXSQUARE ** 2): for posSquare in range(len(possibleSums[val][0])): newSum = possibleSums[val][0][posSquare] + 1 curr = possibleSums[val][1][posSquare] + 1 while val + curr ** 2 <= MAXSQUARE ** 2: nVal = val + curr ** 2 if newSum not in possibleSums[nVal][0]: possibleSums[nVal][0].append(newSum) possibleSums[nVal][1].append(curr) else: index = possibleSums[nVal][0].index(newSum) if curr < possibleSums[nVal][1][index]: possibleSums[nVal][1][index] = curr curr += 1 posKVals = tuple([len(possibleSums[i][0]) for i in range(MAXSQUARE ** 2 + 1)])
-
Python
from itertools import count from sympy.solvers.diophantine.diophantine import power_representation def A379857(n): if n == 0: return 0 c = 0 for i in count(1): if i*(i+1)*((i<<1)+1)>6*n: break if any(len(set(t))==i for t in power_representation(n,2,i)): c += 1 return c # Chai Wah Wu, Jan 28 2025
Formula
a(n) < (3n)^(1/3) for n > 0. I conjecture that a(n) ~ (3n)^(1/3). - Charles R Greathouse IV, Feb 05 2025
Comments