Let f
1(n)=(n
n)mod7
Let f
2(n)=((f
1(n))
n)mod7
Let f
3(n)=((f
2(n))
n)mod7
etc
Evaluate f7(n) for n=1,2....9
Comment upon your results.
n f1(n) thru f7(n)
1 1 1 1 1 1 1 1
2 4 2 4 2 4 2 4
3 6 6 6 6 6 6 6
4 4 4 4 4 4 4 4
5 3 5 3 5 3 5 3
6 1 1 1 1 1 1 1
7 0 0 0 0 0 0 0
8 1 1 1 1 1 1 1
9 1 1 1 1 1 1 1
10 4 4 4 4 4 4 4
11 2 4 2 4 2 4 2
12 1 1 1 1 1 1 1
13 6 6 6 6 6 6 6
14 0 0 0 0 0 0 0
15 1 1 1 1 1 1 1
16 2 2 2 2 2 2 2
17 5 3 5 3 5 3 5
18 1 1 1 1 1 1 1
19 5 5 5 5 5 5 5
20 1 1 1 1 1 1 1
21 0 0 0 0 0 0 0
22 1 1 1 1 1 1 1
23 4 2 4 2 4 2 4
24 1 1 1 1 1 1 1
25 4 4 4 4 4 4 4
26 4 2 4 2 4 2 4
27 6 6 6 6 6 6 6
28 0 0 0 0 0 0 0
29 1 1 1 1 1 1 1
30 1 1 1 1 1 1 1
I don't see a pattern to f7(n). Within a given n, the cycle length is only 1 or 2 going from fx(n) to f(x+1)(n). As a result f7 matches f1, which is n^n mod 7.
Private Sub Form_Load()
Form1.Visible = True
Text1.Text = ""
crlf = Chr$(13) + Chr$(10)
For n = 1 To 30
f1 = 1
For i = 1 To n
f1 = f1 * n Mod 7
Next
f2 = 1
For i = 1 To n
f2 = f2 * f1 Mod 7
Next
f3 = 1
For i = 1 To n
f3 = f3 * f2 Mod 7
Next
f4 = 1
For i = 1 To n
f4 = f4 * f3 Mod 7
Next
f5 = 1
For i = 1 To n
f5 = f5 * f4 Mod 7
Next
f6 = 1
For i = 1 To n
f6 = f6 * f5 Mod 7
Next
f7 = 1
For i = 1 To n
f7 = f7 * f6 Mod 7
Next
Text1.Text = Text1.Text & mform(n, "#0") & " " & Str(f1) & Str(f2) & Str(f3) & Str(f4) & Str(f5) & Str(f6) & Str(f7) & crlf
Next
Text1.Text = Text1.Text & crlf & " done"
End Sub
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-12-22 09:37:15 |