DEFDBL A-Z
CLS
a = 0: n = 0
FOR n = 0 TO 4500
newa = INT((a + n) ^ (1 / 3)) ^ 3
IF a <> newa THEN PRINT n + 1, newa, INT((a + n) ^ (1 / 3))
a = newa
NEXT
lists the values when they change from one n to the next:
2 1 1
8 8 2
20 27 3
38 64 4
62 125 5
92 216 6
128 343 7
170 512 8
218 729 9
272 1000 10
332 1331 11
398 1728 12
470 2197 13
548 2744 14
632 3375 15
722 4096 16
818 4913 17
920 5832 18
1028 6859 19
1142 8000 20
1262 9261 21
1388 10648 22
1520 12167 23
1658 13824 24
1802 15625 25
1952 17576 26
2108 19683 27
2270 21952 28
2438 24389 29
2613 27000 30
2793 29791 31
2978 32768 32
3170 35937 33
3368 39304 34
3572 42875 35
3782 46656 36
3998 50653 37
4220 54872 38
4448 59319 39
The column on the right is the cube root of A(n).
The sequence 2, 8, 20, 38, ..., which are the values of n at which A(n) changes, are found as Sloane's A077588, the Maximum number of regions the plane is divided into by n triangles.
The formula for that is given as 3*n^2 - 3*n + 2, but I'll change the letter to m, to avoid confusion with the puzzle's n: 3*m^2 - 3*m + 2. For a given n in the puzzle problem we want to know the m value that leads to a number no larger than that, so solve 3*m^2 - 3*m + 2 = n. So m = [(3 + sqrt(9 + 12*(n-2)) / 6].
Comparing,
DEFDBL A-Z
CLS
a = 0: n = 0
FOR n = 0 TO 45
newa = INT((a + n) ^ (1 / 3)) ^ 3
PRINT n + 1, newa, INT((a + n) ^ (1 / 3)), INT((3 + SQR(ABS(9 + 12 * (n + 1 - 2)))) / 6)
a = newa
NEXT
finds
1 0 0 0
2 1 1 1
3 1 1 1
4 1 1 1
5 1 1 1
6 1 1 1
7 1 1 1
8 8 2 2
9 8 2 2
10 8 2 2
11 8 2 2
12 8 2 2
13 8 2 2
14 8 2 2
15 8 2 2
16 8 2 2
17 8 2 2
18 8 2 2
19 8 2 2
20 27 3 3
21 27 3 3
22 27 3 3
23 27 3 3
24 27 3 3
25 27 3 3
26 27 3 3
27 27 3 3
28 27 3 3
29 27 3 3
30 27 3 3
31 27 3 3
32 27 3 3
33 27 3 3
34 27 3 3
35 27 3 3
36 27 3 3
37 27 3 3
38 64 4 4
39 64 4 4
40 64 4 4
41 64 4 4
42 64 4 4
43 64 4 4
44 64 4 4
45 64 4 4
46 64 4 4
so it would seem that, cubing the given formula, the answer would be
(INT((3 + SQR(ABS(9 + 12 * (n - 2)))) / 6)) ^ 3
or, using the bracket terminology
[(3 + sqrt(9 + 12 * (n - 2))) / 6] ^ 3
for all values of n greater than 1, as the formula needed fiddling, with an absolute value function for n=1. (Note also that the transition to the next n was done late enough in the program so that N+1 had to be used to represent it).
|
Posted by Charlie
on 2011-02-03 14:57:31 |