In the sequence of triangular numbers, some numbers are twice another.
For example t(20)=210 which is twice t(14)=105.
Characterize all such numbers.
Easy bonus: Explain why (except for the trivial case) there are no square numbers that are twice another.
If n is the ordinality of the smaller triangular number and x the ordinality of the larger, then
x*(x+1) = 2*n*(n+1)
Treating this as a quadratic in x for the given n, we need a positive value of x
(- 1 + sqrt(1 + 8*n^2 + 8*n)) / 2
When this is an integer we have a valid case.
The first two numbers in each line below are the ordinalities and the next two are the actual triangular numbers:
2 3 3 6
14 20 105 210
84 119 3570 7140
492 696 121278 242556
2870 4059 4119885 8239770
16730 23660 139954815 279909630
97512 137903 4754343828 9508687656
568344 803760 161507735340 323015470680
3312554 4684659 5486508657735 10973017315470
DefDbl A-Z
Dim fct(20, 1), crlf$
Function mform$(x, t$)
a$ = Format$(x, t$)
If Len(a$) < Len(t$) Then a$ = Space$(Len(t$) - Len(a$)) & a$
mform$ = a$
End Function
Private Sub Form_Load()
Text1.Text = ""
crlf$ = Chr(13) + Chr(10)
Form1.Visible = True
For n = 1 To 10000000
disc = 1 + 8 * n * n + 8 * n
sr = Int(Sqr(disc) + 0.5)
If sr * sr = disc Then
If sr Mod 2 = 1 Then
x = (sr - 1) / 2
Text1.Text = Text1.Text & n & Str(x) & " " & tr(n) & Str(tr(x)) & crlf
DoEvents
End If
End If
Next
Text1.Text = Text1.Text & "done"
DoEvents
End Sub
Function tr(x)
tr = x * (x + 1) / 2
End Function
The lower triangular number appears as sequence A075528 in Sloane's OEIS, the higher being A029549, with ordinalities A053141 and A001652 respectively.
|
Posted by Charlie
on 2015-02-19 14:07:43 |