A sequence with the recurrence f(n)=3*f(n-1)+f(n-2) starts with two 1-digit numbers. The sequence contains the 8-digit number ABCDAECD. A≠0, and A, B, C, D, and E are not necessarily distinct. Find all possible values of ABCDAECD.
With A, B, C, D and E not necessarily being distinct:
terms
1 2 ABCDAECD
0 3 15291729
0 3 50505150
0 6 30583458
1 1 21932293
1 1 72437443
1 4 21932293
1 4 72437443
2 2 13281128
2 2 43864586
2 5 28572857
2 5 94369736
2 8 13281128
2 8 43864586
3 0 15291729
3 0 50505150
3 3 19921692
3 3 65796879
3 6 10661766
3 6 35213421
3 9 15291729
3 9 50505150
4 4 26562256
5 2 17911091
5 8 48494549
6 0 30583458
6 3 81088608
6 6 39843384
6 9 55135113
7 1 52515751
9 9 59765076
There are 30 rows above but there are only 21 distinct values for ABCDAECD:
10661766
13281128
15291729
17911091
19921692
21932293
26562256
28572857
30583458
35213421
39843384
43864586
48494549
50505150
52515751
55135113
59765076
65796879
72437443
81088608
94369736
DefDbl A-Z
Dim crlf$
Private Sub Form_Load()
Form1.Visible = True
Text1.Text = ""
crlf = Chr$(13) + Chr$(10)
For a = 0 To 9
For b = 0 To 9
x = a: y = b
While x < 100000000 And (x > 0 Or y > 0)
DoEvents
z = 3 * y + x
zs$ = LTrim(Str(z))
If Len(zs) = 8 Then
If Mid(zs, 1, 1) = Mid(zs, 5, 1) And Mid(zs, 3, 1) = Mid(zs, 7, 1) And Mid(zs, 4, 1) = Mid(zs, 8, 1) Then
' If Mid(zs, 1, 1) <> Mid(zs, 2, 1) And Mid(zs, 1, 1) <> Mid(zs, 3, 1) And Mid(zs, 1, 1) <> Mid(zs, 4, 1) Then
' If Mid(zs, 2, 1) <> Mid(zs, 3, 1) And Mid(zs, 2, 1) <> Mid(zs, 4, 1) And Mid(zs, 2, 1) <> Mid(zs, 6, 1) And Mid(zs, 2, 1) <> Mid(zs, 6, 1) Then
' If Mid(zs, 3, 1) <> Mid(zs, 4, 1) And Mid(zs, 3, 1) <> Mid(zs, 6, 1) Then
Text1.Text = Text1.Text & a & Str(b) & " " & z & crlf
' End If
' End If
' End If
End If
End If
x = y: y = z
Wend
Next b
Next a
Text1.Text = Text1.Text & crlf & " done"
End Sub
Notice the commented out code would make A, B, C, D and E necessarily distinct. With that code restored, to require distinct A, B, C, D and E, the results would be:
0 3 15291729
0 6 30583458
2 2 43864586
2 5 94369736
2 8 43864586
3 0 15291729
3 3 65796879
3 6 35213421
3 9 15291729
6 0 30583458
9 9 59765076
These are 7 distinct values:
15291729
30583458
35213421
43864586
59765076
65796879
94369736
Note that in many cases, a given starting pair, such as 1,4, will produce two different numbers in the same sequence that fit the pattern.
Edited on January 17, 2017, 11:34 am
|
Posted by Charlie
on 2017-01-17 11:20:42 |