Add new comment

Comment

How to derive the formula?
Enumerate the first 15 possibilities:
N: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
NS: 0 1 0 1 2 1 2 3 2 3 4 3 4 5 4
NS is number of sets

See the pattern:
1: N: 1 4 7 10 13
NS: 0 1 2 3 4
2: N: 2 5 8 11 14
NS: 1 2 3 4 5
3: N: 3 6 9 12 15
NS: 0 1 2 3 4

or

1: N mod(3) = 1 -> NS = (N - 1) / 3
2: N mod(3) = 2 -> NS = (N + 1) / 3
3: N mod(3) = 0 -> NS = (N - 3) / 3

and

1: (N – 1) / 3 = (N - 3 + 2 * 1) / 3
2: (N + 1) / 3 = (N - 3 + 2 * 2) / 3
3: (N – 3) / 3 = (N - 3 + 2 * 0) / 3

All together: NS = (N - 3 + 2 * N(mod(3)) / 3
I verified the result for N = 1 up to 10000. Everything OK.

Hub.

Filtered HTML

  • Web page addresses and email addresses turn into links automatically.
  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.