Which triangular numbers are three times a pentagonal number?
Is there a geometrical interpretation to this?
(In reply to
computer method by Charlie)
The kth triangular number is 3 times a pentagonal number if k = 2 mod 3.
DefDbl A-Z
Dim crlf$
Private Sub Form_Load()
Form1.Visible = True
Text1.Text = ""
crlf = Chr$(13) + Chr$(10)
For n = 1 To 1000
DoEvents
p = (3 * n * n - n) / 2
tr = 3 * p
Text1.Text = Text1.Text & mform(n, "####0") & mform(p, "#########0") & mform(p * 3, "#########0") & mform(isTri(tr), "######0") & crlf
Next
Text1.Text = Text1.Text & crlf & " done"
End Sub
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 mform$(x, t$)
a$ = Format$(x, t$)
If Len(a$) < Len(t$) Then a$ = Space$(Len(t$) - Len(a$)) & a$
mform$ = a$
End Function
|
Posted by Charlie
on 2016-07-01 10:14:21 |