A, B, C and D are triangular numbers.
A, B and C are always consecutive while D is their sum.
Determine (and explain as best as possible1) how such sets of values are distributed across the number system.
1. This can be explained in terms of a single variable expression.
DECLARE FUNCTION isTri# (t#)
DECLARE FUNCTION tr# (n#)
DEFDBL A-Z
tr1 = 1
tr2 = 3
tr3 = 6
adder = 4
sum = tr1 + tr2 + tr3
DO
IF isTri(sum) THEN PRINT tr1; tr2; tr3, isTri(tr1); isTri(tr2); isTri(tr3), sum; isTri(sum): PRINT
tr4 = tr3 + adder: adder = adder + 1
sum = sum - tr1 + tr4
tr1 = tr2: tr2 = tr3: tr3 = tr4
LOOP
FUNCTION isTri (t)
n = INT(SQR(t * 2))
np = n + 1
IF n * np = 2 * t THEN isTri = n: ELSE isTri = 0
END FUNCTION
FUNCTION tr (n)
tr = n * (n + 1) / 2
END FUNCTION
finds Among triangular numbers
Ordinal of
A B C A B C D Ord of D
1 3 6 1 2 3 10 4
36 45 55 8 9 10 136 16
595 630 666 34 35 36 1891 61
8646 8778 8911 131 132 133 26335 229
121771 122265 122760 493 494 495 366796 856
1701090 1702935 1704781 1844 1845 1846 5108806 3196
23711941 23718828 23725716 6886 6887 6888 71156485 11929
330334956 330360660 330386365 25703 25704 25705 991081981 44521
4601234485 4601330415 4601426346 95929 95930 95931 13803991246 166156
64087907136 64088265153 64088623171 358016 358017 358018 192264795460 620104
892633045591 892634381730 892635717870 1336138 1336139 1336140 2677903145191 2314261
12432788092530 12432793079070 12432798065611 4986539 4986540 4986541 37298379237211 8636941
The ordinal triangular number of A, follows Sloane's A082840, which has a comment by our own brianjn, based upon this problem. The ordinal position of D is given by A133161.
The formula given in Sloane for the ordinal of A (i.e., the nth triangular number), is:
With a=2+sqrt(3), b=2-sqrt(3)
a(n)=-3/2+(1/12)(a-2b+5)a^n+(1/12)(b-2a+5)b^n.
To test that out:
DEFDBL A-Z
CLS
a = 2 + SQR(3): b = 2 - SQR(3)
FOR n = 1 TO 10
ans = -3 / 2 + (1 / 12) * (a - 2 * b + 5) * a ^ n + (1 / 12) * (b - 2 * a + 5) * b ^ n
PRINT n, ans; TAB(38); INT(ans + .000000001#)
NEXT
finds:
1 .9999999999999999 1
2 7.999999999999999 8
3 34 34
4 131 131
5 492.9999999999999 493
6 1844 1844
7 6885.999999999998 6886
8 25702.99999999999 25703
9 95928.99999999997 95929
10 358015.9999999999 358016
The successive 9's show the rounded value at the right is the actual value.
|
Posted by Charlie
on 2009-11-29 19:04:46 |