-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProblem-40.nb
109 lines (102 loc) · 3.28 KB
/
Problem-40.nb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
(* Content-type: application/mathematica *)
(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)
(* CreatedBy='Mathematica 7.0' *)
(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[ 145, 7]
NotebookDataLength[ 3171, 99]
NotebookOptionsPosition[ 2917, 86]
NotebookOutlinePosition[ 3260, 101]
CellTagsIndexPosition[ 3217, 98]
WindowFrame->Normal*)
(* Beginning of Notebook Content *)
Notebook[{
Cell[BoxData[{
RowBox[{
RowBox[{"len", " ", "=", " ", "1"}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"f", " ", "=", " ",
RowBox[{"Table", "[",
RowBox[{
RowBox[{"i", "*", "0"}], " ", ",", " ",
RowBox[{"{",
RowBox[{"i", " ", ",", " ", "1000100"}], "}"}]}], "]"}]}],
";"}], "\[IndentingNewLine]",
RowBox[{"For", "[",
RowBox[{
RowBox[{"i", " ", "=", " ", "1"}], " ", ",", " ",
RowBox[{"len", " ", "\[LessEqual]", " ", "1000000"}], " ", ",", " ",
RowBox[{"i", " ", "++"}], ",", "\[IndentingNewLine]",
RowBox[{
RowBox[{"l", " ", "=", " ",
RowBox[{"IntegerDigits", "[", "i", "]"}]}], ";", "\[IndentingNewLine]",
RowBox[{"sz", " ", "=", " ",
RowBox[{"Length", "[", "l", "]"}]}], ";", "\[IndentingNewLine]",
RowBox[{"For", "[",
RowBox[{
RowBox[{"j", " ", "=", " ", "1"}], " ", ",", " ",
RowBox[{"j", " ", "\[LessEqual]", " ", "sz"}], " ", ",", " ",
RowBox[{"j", " ", "++"}], " ", ",", " ",
RowBox[{
RowBox[{
RowBox[{"f", "[",
RowBox[{"[", "len", "]"}], "]"}], " ", "=", " ",
RowBox[{"l", "[",
RowBox[{"[", "j", "]"}], "]"}]}], ";",
RowBox[{"len", " ", "++"}]}]}], "]"}], ";"}]}], "\[IndentingNewLine]",
"]"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"Print", "[",
RowBox[{"f", "[",
RowBox[{"[", "1", "]"}], "]"}], "]"}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"Print", "[",
RowBox[{"f", "[",
RowBox[{"[", "10", "]"}], "]"}], "]"}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"Print", "[",
RowBox[{"f", "[",
RowBox[{"[", "100", "]"}], "]"}], "]"}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"Print", "[",
RowBox[{"f", "[",
RowBox[{"[", "1000", "]"}], "]"}], "]"}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"Print", "[",
RowBox[{"f", "[",
RowBox[{"[", "10000", "]"}], "]"}], "]"}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"Print", "[",
RowBox[{"f", "[",
RowBox[{"[", "100000", "]"}], "]"}], "]"}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"Print", "[",
RowBox[{"f", "[",
RowBox[{"[", "1000000", "]"}], "]"}], "]"}],
";"}], "\[IndentingNewLine]"}], "Input",
CellChangeTimes->{{3.49442444407714*^9, 3.49442463011178*^9}, {
3.4944246968495975`*^9, 3.494424711426431*^9}}]
},
WindowSize->{607, 549},
WindowMargins->{{0, Automatic}, {Automatic, 0}},
FrontEndVersion->"7.0 for Microsoft Windows (32-bit) (November 10, 2008)",
StyleDefinitions->"Default.nb"
]
(* End of Notebook Content *)
(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[545, 20, 2368, 64, 312, "Input"]
}
]
*)
(* End of internal cache information *)