Consider the following questions about sets of natural numbers:

Given a natural number \(n\), what is the largest subset of the natural numbers up to \(n\) such that no sums of two elements from this subset are squares? (For the remainder of the article, we will refer to this maximum subset as "the largest square sumless subset")

What percentage of the natural numbers can we include in a subset that has this "sumless" property?

How does this compare to other sets, ex. avoiding cubes, prime numbers, Fibonacci numbers, etc?

For example: What is the largest square sumless subset of \([1,3]\)?

We can pick either \(\{1\}\) or \(\{3\}\), but not both because \(1+3=2^2\). We also can not pick \(\{2\}\) because \(2+2=2^2\).

This problem is at the intersection of extremal number theory and extremal graph theory, and as with my other pages, I plan to continue to update this page as I find new results. After reading this page, if you have any new results, let me know and I will link to them or add them and attribute them to you.

The density of the squares in the natural numbers up to \(n\) is trivially \(\frac{1}{\sqrt{n}}\) which tends to \(0\) as \(n\) goes to infinity, so perhaps we might expect similar asymptotic behavior for the ratio of the largest square sumless subset to all natural numbers; however, my best lower bound (so far) via construction is \(\frac{1}{3} \approx 33.33%\) and my best upper bound is \(\frac{1}{2}+\epsilon\) beyond the trivial problem of \([1,1]\)

There are two constructions that achieve this bound:

The less complicated construction involves taking all of the numbers \(\equiv 1\mod 3\) because \(2\) is quadratic nonresidue modulo \(3\).

The more complicated construction which achieves this bound is as follows:

Take all of the natural numbers \(x\) such that \(x \equiv (3 \times 4^{y-1}) \mod 4^y\) for some non-zero \(y \in \mathbb{N}\). Given that \(\sum_{y=1}^{\infty}\frac{1}{4^y}=\frac{1}{3}\) we get the lower bound construction.

A brief informal sketch of the proof that this subset contains no squares is as follows:

Take two natural numbers of the required form: \(4^a + 3 \times 4^{a-1}\) and \(4^b + 3 \times 4^{b-1}\) (WLOG, assume that \(a \geq b\))

Adding them together we get \(4^a + 4^b + 3 \times (4^{a-1}+4^{b-1})\)

We can divide through by \(4^{b-1}\) which is a square to get \(4^{a-b+1} + 4 + 3 \times 4^{a-b} + 3\)

When \(a=b\) we have \(4 + 4 + 3 + 3 \equiv 2\mod 4\).

When \(a \neq b\) we have \(4(4^{a-b} + 1 + 3 \times 4^{a-b-1}) + 3 \equiv 3\mod 4\).

\(2\) and \(3\) are quadratic nonresidue modulo \(4\), so the sums of elements in our subset will never be squares.

There are two ways of going about proving the upper bound of at least \(\frac{1}{2}+\epsilon\). Here is a very informal sketch of both ideas which also apply to other variants of the problem avoiding other sequences/subsets (ex. cubes or primes).

If there is a square sufficiently close to \(N\), then we split our subset of natural numbers at \(\frac{N}{2}\). At best we can either take \(\left \lfloor \frac{N}{2} \right \rfloor + a\) or \(\left \lfloor \frac{N}{2} \right \rfloor - a\) for all \(a \leq \left \lfloor \frac{N}{2} \right \rfloor\). In this case we are done, we have achieved a maximum density of \(\frac{1}{2}+\epsilon\).

An alternative approach is to iteratively take the next even square, perform this pairing around it, in this way we can assign each natural number to a square and each natural number to a unique pair (aside from those who are halves of squares). Each of these pairs can only contribute 1 number to the final maximal square sumless subset.

This bound is the most flexible when both there is no square sufficiently close to \(N\) and \(N\) is half of a square.

I have phrased this question in terms of sets of natural numbers, but we can just as well construct a graph with natural number vertices, edges between each two vertices when they add to a square, and then ask about the largest independent set of that graph. I believe that a non-trivial upper bound will be found through expressing this problem in that way.

I have calculated the maximal sized subsets from [0,1] to [0,100] using an inductive approach and determined the number of unique maximal subsets for each of these subsets of the natural numbers. All of the maximal subsets are slightly better than (or equal to) my best lower bound of \(\frac{1}{3}\), and when plotted, a line with a slope of \( \approx .365\) fits them with \(r^2 \approx .996\).

Below is a table of this information, and beneath this table is a discussion of maximal subsets that avoid other interesting sets of natural numbers.

[1,N] | Max Subset Size | Number of Optimal Subsets | Lexically First Maximal Subset (including N) of equal or greater size to the maximal N-1 case |
---|---|---|---|

1 | 1 | 1 | 1 |

2 | 1 | 1 | - |

3 | 1 | 2 | 3 |

4 | 2 | 2 | 1 4 |

5 | 2 | 4 | 1 5 |

6 | 3 | 2 | 1 4 6 |

7 | 4 | 2 | 1 4 6 7 |

8 | 4 | 2 | - |

9 | 4 | 4 | 1 4 6 9 |

10 | 4 | 12 | 1 4 7 10 |

11 | 5 | 6 | 1 4 6 7 11 |

12 | 5 | 18 | 1 5 6 7 12 |

13 | 6 | 4 | 1 4 6 7 11 13 |

14 | 6 | 18 | 1 4 6 7 13 14 |

15 | 6 | 28 | 3 5 7 12 14 15 |

16 | 7 | 14 | 1 4 6 7 11 13 16 |

17 | 8 | 14 | 1 4 6 7 11 13 16 17 |

18 | 8 | 14 | - |

19 | 8 | 20 | 1 4 7 10 11 13 16 19 |

20 | 8 | 36 | 1 4 6 7 11 13 17 20 |

21 | 9 | 8 | 1 5 6 7 12 14 16 17 21 |

22 | 9 | 44 | 1 4 6 7 11 13 16 17 22 |

23 | 10 | 17 | 1 5 6 7 12 14 16 17 21 23 |

24 | 10 | 25 | 3 5 7 10 14 16 17 21 23 24 |

25 | 11 | 8 | 1 5 6 7 12 14 16 17 21 23 25 |

26 | 11 | 15 | 1 5 6 7 12 14 16 17 21 25 26 |

27 | 12 | 7 | 1 5 6 7 12 14 16 17 21 23 25 27 |

28 | 12 | 33 | 1 4 6 7 13 14 16 17 25 26 27 28 |

29 | 12 | 61 | 1 4 6 13 14 16 17 25 26 27 28 29 |

30 | 13 | 12 | 1 5 7 10 12 14 16 17 21 23 25 27 30 |

31 | 13 | 97 | 1 4 6 7 13 14 16 17 25 26 27 28 31 |

32 | 13 | 97 | - |

33 | 13 | 123 | 1 4 6 7 13 14 17 20 25 26 27 28 33 |

34 | 14 | 4 | 1 4 6 7 13 14 16 17 25 26 27 28 31 34 |

35 | 14 | 38 | 3 4 7 10 11 16 17 23 24 27 28 30 31 35 |

36 | 14 | 134 | 1 5 6 7 12 14 16 17 21 23 25 27 34 36 |

37 | 15 | 15 | 4 6 7 11 13 15 16 17 22 24 26 28 31 35 37 |

38 | 15 | 87 | 1 5 6 7 12 14 16 17 21 23 25 27 34 36 38 |

39 | 16 | 15 | 4 6 7 11 13 15 16 17 22 24 26 28 31 35 37 39 |

40 | 16 | 92 | 1 4 6 7 11 13 16 17 22 26 28 31 34 37 39 40 |

41 | 17 | 15 | 4 6 7 11 13 15 16 17 22 24 26 28 31 35 37 39 41 |

42 | 17 | 33 | 1 5 6 12 14 16 17 21 23 25 27 29 34 36 38 40 42 |

43 | 18 | 5 | 4 7 11 13 15 16 17 22 24 26 28 30 31 35 37 39 41 43 |

44 | 18 | 16 | 1 6 12 14 16 17 21 23 25 27 29 31 34 36 38 40 42 44 |

45 | 18 | 45 | 1 6 12 14 16 17 21 23 25 27 29 31 34 38 40 42 44 45 |

46 | 19 | 12 | 1 6 12 14 16 17 21 23 25 27 29 31 34 36 38 40 42 44 46 |

47 | 19 | 17 | 1 10 12 14 16 19 21 23 25 27 29 31 36 38 40 42 44 46 47 |

48 | 19 | 47 | 4 7 11 13 15 17 20 22 24 26 28 30 31 35 37 39 41 43 48 |

49 | 20 | 17 | 1 6 12 14 16 17 21 23 25 27 29 31 34 36 38 40 42 44 46 49 |

50 | 20 | 17 | - |

51 | 20 | 26 | 1 6 12 14 16 17 21 23 25 27 29 31 34 36 38 40 42 44 46 51 |

52 | 20 | 28 | 3 4 7 11 15 16 19 24 26 27 28 31 35 39 41 43 44 47 51 52 |

53 | 21 | 12 | 1 6 12 14 16 17 21 23 25 27 29 31 34 36 38 40 42 44 46 49 53 |

54 | 21 | 12 | - |

55 | 22 | 7 | 1 6 12 14 16 17 21 23 25 27 29 31 34 36 38 40 42 44 46 49 53 55 |

56 | 22 | 7 | - |

57 | 23 | 7 | 1 6 12 14 16 17 21 23 25 27 29 31 34 36 38 40 42 44 46 49 53 55 57 |

58 | 23 | 7 | - |

59 | 24 | 7 | 1 6 12 14 16 17 21 23 25 27 29 31 34 36 38 40 42 44 46 49 53 55 57 59 |

60 | 24 | 7 | - |

61 | 25 | 7 | 1 6 12 14 16 17 21 23 25 27 29 31 34 36 38 40 42 44 46 49 53 55 57 59 61 |

62 | 25 | 7 | - |

63 | 25 | 21 | 6 12 14 16 17 21 23 25 27 29 31 34 36 38 40 42 44 46 49 53 55 57 59 61 63 |

64 | 25 | 35 | 7 11 13 15 16 22 24 26 28 30 31 35 37 39 41 43 45 47 52 54 56 58 60 62 64 |

65 | 26 | 7 | 6 12 14 17 21 23 25 27 29 31 34 36 38 40 42 44 46 48 49 53 55 57 59 61 63 65 |

66 | 26 | 16 | 7 11 13 16 22 24 26 28 30 31 35 37 39 41 43 45 47 49 52 54 56 58 60 62 64 66 |

67 | 26 | 48 | 1 7 11 13 16 22 26 28 30 31 37 39 41 43 45 46 47 49 52 56 58 60 62 64 66 67 |

68 | 26 | 148 | 1 7 11 16 22 26 28 30 31 37 39 41 43 45 46 47 49 52 56 58 60 62 64 66 67 68 |

69 | 26 | 188 | 3 5 9 14 24 26 28 29 30 37 39 41 43 45 47 48 49 54 56 58 60 62 64 66 68 69 |

70 | 27 | 16 | 6 12 14 17 21 23 25 27 29 31 34 36 38 40 42 44 46 48 49 53 55 57 59 61 63 65 70 |

71 | 27 | 118 | 1 7 11 13 16 22 26 28 30 31 37 39 41 43 45 46 47 49 52 56 58 60 62 64 66 67 71 |

72 | 27 | 118 | - |

73 | 27 | 169 | 1 5 6 9 13 14 17 21 25 26 29 33 34 37 41 42 45 46 49 53 57 61 62 65 69 70 73 |

74 | 27 | 223 | 1 5 9 10 13 14 17 21 25 29 30 33 37 38 41 42 45 46 49 53 57 61 65 66 69 73 74 |

75 | 28 | 66 | 3 7 11 12 20 26 27 28 30 31 35 39 41 43 45 47 48 49 56 58 60 62 64 66 67 68 71 75 |

76 | 28 | 94 | 6 12 14 17 21 23 25 27 29 31 34 36 38 40 42 44 46 48 49 53 55 57 59 61 63 65 70 76 |

77 | 29 | 32 | 3 7 11 16 24 26 28 30 31 35 37 39 41 43 45 47 49 52 54 56 58 60 62 64 66 68 71 75 77 |

78 | 29 | 60 | 1 5 6 9 13 14 17 21 25 26 29 33 34 37 41 42 45 46 49 53 57 61 62 65 69 70 73 77 78 |

79 | 30 | 32 | 3 7 11 16 24 26 28 30 31 35 37 39 41 43 45 47 49 52 54 56 58 60 62 64 66 68 71 75 77 79 |

80 | 30 | 58 | 6 12 14 17 21 23 25 27 29 31 34 36 38 40 42 44 46 48 49 53 55 57 59 61 63 65 70 76 78 80 |

81 | 31 | 32 | 3 7 11 16 24 26 28 30 31 35 37 39 41 43 45 47 49 52 54 56 58 60 62 64 66 68 71 75 77 79 81 |

82 | 31 | 58 | 6 12 14 17 21 23 25 27 29 31 34 36 38 40 42 44 46 48 49 53 55 57 59 61 63 65 70 76 78 80 82 |

83 | 32 | 32 | 3 7 11 16 24 26 28 30 31 35 37 39 41 43 45 47 49 52 54 56 58 60 62 64 66 68 71 75 77 79 81 83 |

84 | 32 | 58 | 6 12 14 17 21 23 25 27 29 31 34 36 38 40 42 44 46 48 49 53 55 57 59 61 63 65 70 76 78 80 82 84 |

85 | 33 | 32 | 3 7 11 16 24 26 28 30 31 35 37 39 41 43 45 47 49 52 54 56 58 60 62 64 66 68 71 75 77 79 81 83 85 |

86 | 33 | 45 | 6 12 17 21 23 25 27 29 31 34 36 38 40 42 44 46 48 49 53 55 57 59 61 63 65 67 70 76 78 80 82 84 86 |

87 | 34 | 20 | 3 7 11 16 24 26 28 30 31 35 37 39 41 43 45 47 49 52 54 56 58 60 62 64 66 68 71 75 77 79 81 83 85 87 |

88 | 34 | 20 | - |

89 | 34 | 96 | 3 5 7 14 16 24 26 28 30 37 39 41 43 45 47 49 52 54 56 58 60 62 64 66 68 71 75 77 79 81 83 85 87 89 |

90 | 34 | 110 | 4 6 15 17 23 25 27 29 36 38 40 42 44 46 48 51 53 55 57 59 61 63 65 67 69 74 76 78 80 82 84 86 88 90 |

91 | 35 | 25 | 3 5 7 14 16 24 26 28 37 39 41 43 45 47 49 52 54 56 58 60 62 64 66 68 70 71 75 77 79 81 83 85 87 89 91 |

92 | 35 | 39 | 3 7 12 20 26 27 28 31 35 39 41 43 45 47 48 49 56 58 60 62 64 66 67 68 70 71 75 79 81 83 85 87 89 91 92 |

93 | 35 | 51 | 4 6 17 23 25 27 34 36 38 40 42 44 46 48 49 53 55 57 59 61 63 65 67 69 70 71 78 80 82 84 86 88 90 92 93 |

94 | 35 | 148 | 1 5 7 16 22 26 28 37 39 41 43 45 46 47 49 56 58 60 62 64 66 67 68 69 70 71 79 81 83 85 87 89 91 92 94 |

95 | 35 | 169 | 4 6 15 17 23 25 27 36 38 40 42 44 46 48 51 53 55 57 59 61 63 65 67 69 71 76 78 80 82 84 86 88 90 92 95 |

96 | 36 | 40 | 1 5 7 16 22 26 28 37 39 41 43 45 46 47 49 56 58 60 62 64 66 67 68 69 70 71 79 81 83 85 87 89 91 92 94 96 |

97 | 36 | 76 | 1 5 7 16 22 26 28 37 39 41 43 45 46 49 56 58 60 62 64 66 67 68 69 70 71 79 81 83 85 87 89 91 92 94 96 97 |

98 | 36 | 76 | - |

99 | 36 | 90 | 4 6 15 17 23 25 27 36 38 40 42 44 46 48 51 53 55 57 59 61 63 65 67 69 71 74 76 78 80 82 84 86 88 90 92 99 |

100 | 36 | 162 | 3 4 7 11 15 19 20 23 24 27 28 31 35 39 43 47 48 51 55 56 59 63 64 67 68 71 75 79 83 84 87 91 92 95 99 100 |

Perhaps this will be the only time that you will hear this, but of all the sets that I have tried, the primes are the least interesting (at least in the range that I tested). To avoid prime numbers, you can either select all of the even natural numbers or all of the odd natural numbers except for \(1\). In the extremal case, \(\frac{1}{2}+\epsilon\) density is the best that I can achieve. On bounded intervals of natural numbers, ex. [0,N], to improve this construction would require the following two conditions:

- A prime gap of at least \(\frac{N}{2}\)
- No primes around \(\frac{N}{2}\)

I conjecture that the maximal subset is this trivial solution.

The next two logical directions to go was to extend my search to maximal subsets that avoid cubes and that avoid Fibonacci Numbers.

The subsets that avoid these two sequences have similar densities at a small scale, but their growth is very different in this window.

Here is a graph of these values where blue is the max subset avoiding square sums, black is the max subset avoiding cube sums, and red is is max avoiding Fibonacci numbers.

The cubes oscillate between plateaus and sharp increases in max set subset size, while the Fibonacci case increases the maximum subset size more regularly. Both have a large number of maximal subsets for each value of \(N\) as well.

As an interesting note, the greedy approach of taking the next lowest possible value that does not sum with any existing values or itself to be a cube produces the exact same subset as the Lexically First Maximal Subset for the range of values that I checked. The places where the graph increases are the numbers which are included in this subset.

This greedy approach eventually fails to generate maximal subsets (it drastically decreases in density as you continue to larger sets of higher natural numbers). It is trivially possible to take \(\frac{1}{3}\) of the natural numbers by selecting all numbers with a remainder of \(1\), \(2\), or \(3\) modulo \(9\). (Proof omitted), and the density of the numbers selected by the greedy approach as \(N\) increases dips down near \(\frac{1}{4}\) around \(N=50,000\) before rebounding and increasing. Depending on the values that you use to seed the greedy approach (that is to say fix certain initial values to be part of the subset), it is possible to get wildly different curves; however, the best one appears to be unseeded in contrast to what we see for greedy squares and Fibonacci numbers.

Below is a graph of the density of this greedy subsets avoiding cubes for large values of \(N\), showing the aforementioned rebound behavior:

More theoretical work is needed to determine if this initial local behavior for Fibonacci numbers and cubes continues for larger intervals of the natural numbers.

(a) Can the upper and lower bounds on the size of subsets whose sums avoid squares be improved? (If so, how?)

(b) Can the upper and lower bounds on the size of subsets whose sums avoid cubes be improved? (If so, how?)

(c) Subsets whose sums avoid Fibonacci numbers are particularly resistant to trivial constructions. Is there a good construction over the natural numbers?

(d) Can we find non-trivial upper and lower bounds on the size of subsets whose sums avoid Fibonacci numbers? (If so, what are they?)

(e) Is the construction for subsets that avoid primes maximal for all \(N\)?

(f) Suppose instead I am picking a subset of rational numbers in the interval [0,1], how does the density of the maximal subset of this interval whose sums avoid rational squares compare to the natural numbers case?

Email: zachdestefano@gmail (dot) com