The first three terms of sequence {C(n)} are 1440, 1716 and 1848. These are obtained by multiplying the corresponding terms of two arithmetic sequences:{A(n)} and {B(n)}.
Find the 8th term of {C(n)}
1440 has factors:
2^5
3^2
5^1
so there are 6*3*2 = 36 ways of allocating it to sequence A vs sequence B.
1716 has factors:
2^2
3^1
11^1
13^1
so there are 3*2*2*2 = 24 ways of allocating it to sequence A vs sequence B.
And there are 36*24 = 864 possibilities to check to see if the products of their third members multiply to produce 1848.
Twelve of these 864 possibilities result in the next product being 1848, and all of them produce the same product sequence, C:
term
A B C
1 15 96 1440
2 13 132 1716
3 11 168 1848
4 9 204 1836
5 7 240 1680
6 5 276 1380
7 3 312 936
8 1 348 348
1 45 32 1440
2 39 44 1716
3 33 56 1848
4 27 68 1836
5 21 80 1680
6 15 92 1380
7 9 104 936
8 3 116 348
1 30 48 1440
2 26 66 1716
3 22 84 1848
4 18 102 1836
5 14 120 1680
6 10 138 1380
7 6 156 936
8 2 174 348
1 90 16 1440
2 78 22 1716
3 66 28 1848
4 54 34 1836
5 42 40 1680
6 30 46 1380
7 18 52 936
8 6 58 348
1 60 24 1440
2 52 33 1716
3 44 42 1848
4 36 51 1836
5 28 60 1680
6 20 69 1380
7 12 78 936
8 4 87 348
1 180 8 1440
2 156 11 1716
3 132 14 1848
4 108 17 1836
5 84 20 1680
6 60 23 1380
7 36 26 936
8 12 29 348
1 8 180 1440
2 11 156 1716
3 14 132 1848
4 17 108 1836
5 20 84 1680
6 23 60 1380
7 26 36 936
8 29 12 348
1 24 60 1440
2 33 52 1716
3 42 44 1848
4 51 36 1836
5 60 28 1680
6 69 20 1380
7 78 12 936
8 87 4 348
1 16 90 1440
2 22 78 1716
3 28 66 1848
4 34 54 1836
5 40 42 1680
6 46 30 1380
7 52 18 936
8 58 6 348
1 48 30 1440
2 66 26 1716
3 84 22 1848
4 102 18 1836
5 120 14 1680
6 138 10 1380
7 156 6 936
8 174 2 348
1 32 45 1440
2 44 39 1716
3 56 33 1848
4 68 27 1836
5 80 21 1680
6 92 15 1380
7 104 9 936
8 116 3 348
1 96 15 1440
2 132 13 1716
3 168 11 1848
4 204 9 1836
5 240 7 1680
6 276 5 1380
7 312 3 936
8 348 1 348
where the 8th term is 348.
DefDbl A-Z
Dim crlf$, fct(20, 1), fct1(20, 1), fct2(20, 1)
Private Sub Form_Load()
Form1.Visible = True
Text1.Text = ""
crlf = Chr$(13) + Chr$(10)
f1 = factor(1440)
For i = 1 To f1
fct1(i, 0) = fct(i, 0)
fct1(i, 1) = fct(i, 1)
Text1.Text = Text1.Text & fct(i, 0) & Str(fct(i, 1)) & crlf
Next
Text1.Text = Text1.Text & f1 & crlf
f2 = factor(1716)
For i = 1 To f2
fct2(i, 0) = fct(i, 0)
fct2(i, 1) = fct(i, 1)
Text1.Text = Text1.Text & fct(i, 0) & Str(fct(i, 1)) & crlf
Next
Text1.Text = Text1.Text & f2 & crlf
' the output of the above determined the following code, for easier coding:
' (avoiding recursive calls)
For fcta2 = 0 To 5
For fcta3 = 0 To 2
For fcta5 = 0 To 1
terma1 = Int(2 ^ fcta2 * 3 ^ fcta3 * 5 ^ fcta5 + 0.5)
termb1 = 1440 / terma1
For fctb2 = 0 To 2
For fctb3 = 0 To 1
For fctb11 = 0 To 1
For fctb13 = 0 To 1
terma2 = Int(2 ^ fctb2 * 3 ^ fctb3 * 11 ^ fctb11 * 13 ^ fctb13 + 0.5)
termb2 = 1716 / terma2
terma3 = 2 * terma2 - terma1
termb3 = 2 * termb2 - termb1
termc3 = terma3 * termb3
terma = terma3: termb = termb3
preva = terma2: prevb = termb2
If termc3 = 1848 Then
Text1.Text = Text1.Text & 1 & Str(terma1) & Str(termb1) & Str(1440) & crlf
Text1.Text = Text1.Text & 2 & Str(terma2) & Str(termb2) & Str(1716) & crlf
Text1.Text = Text1.Text & 3 & Str(terma3) & Str(termb3) & Str(termc3) & crlf
For termno = 4 To 8
newterma = 2 * terma - preva
newtermb = 2 * termb - prevb
preva = terma: prevb = termb
terma = newterma: termb = newtermb
termc = terma * termb
Text1.Text = Text1.Text & termno & Str(terma) & Str(termb) & Str(termc) & crlf
Next
Text1.Text = Text1.Text & crlf
End If
Next
Next
Next
Next
Next
Next
Next
Text1.Text = Text1.Text & crlf & " done"
End Sub
Function factor(num)
diffCt = 0: good = 1
n = Abs(num): If n > 0 Then limit = Sqr(n) Else limit = 0
If limit <> Int(limit) Then limit = Int(limit + 1)
dv = 2: GoSub DivideIt
dv = 3: GoSub DivideIt
dv = 5: GoSub DivideIt
dv = 7
Do Until dv > limit
GoSub DivideIt: dv = dv + 4 '11
GoSub DivideIt: dv = dv + 2 '13
GoSub DivideIt: dv = dv + 4 '17
GoSub DivideIt: dv = dv + 2 '19
GoSub DivideIt: dv = dv + 4 '23
GoSub DivideIt: dv = dv + 6 '29
GoSub DivideIt: dv = dv + 2 '31
GoSub DivideIt: dv = dv + 6 '37
If INKEY$ = Chr$(27) Then s$ = Chr$(27): Exit Function
Loop
If n > 1 Then diffCt = diffCt + 1: fct(diffCt, 0) = n: fct(diffCt, 1) = 1
factor = diffCt
Exit Function
DivideIt:
cnt = 0
Do
q = Int(n / dv)
If q * dv = n And n > 0 Then
n = q: cnt = cnt + 1: If n > 0 Then limit = Sqr(n) Else limit = 0
If limit <> Int(limit) Then limit = Int(limit + 1)
Else
Exit Do
End If
Loop
If cnt > 0 Then
diffCt = diffCt + 1
fct(diffCt, 0) = dv
fct(diffCt, 1) = cnt
End If
Return
End Function
|
Posted by Charlie
on 2016-03-07 13:43:58 |