代码拉取完成,页面将自动刷新
(* Content-type: application/vnd.wolfram.mathematica *)
(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)
(* CreatedBy='Mathematica 11.0' *)
(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[ 158, 7]
NotebookDataLength[ 88158, 1869]
NotebookOptionsPosition[ 83309, 1716]
NotebookOutlinePosition[ 83771, 1735]
CellTagsIndexPosition[ 83728, 1732]
WindowFrame->Normal*)
(* Beginning of Notebook Content *)
Notebook[{
Cell[CellGroupData[{
Cell["Project Euler 31-40", "Title",
CellChangeTimes->{{3.82599534582302*^9, 3.82599534949002*^9}, {
3.826344412413868*^9, 3.826344414059868*^9}, {3.8286676420194197`*^9,
3.828667643396558*^9}},
TextAlignment->Center],
Cell[CellGroupData[{
Cell["\[FilledSquare]31. Coin sums", "Subsubsection",
CellGroupingRules->{"GroupTogetherGrouping", 10000.},
CellChangeTimes->{
3.82580077140097*^9, {3.825995270185877*^9, 3.8259952717480335`*^9},
3.82599530340602*^9, {3.828667656163834*^9, 3.8286676703462524`*^9}}],
Cell["\<\
In the United Kingdom the currency is made up of pound (\[Sterling]) and \
pence (p). There are eight coins in general circulation:
1p, 2p, 5p, 10p, 20p, 50p, \[Sterling]1 (100p), and \[Sterling]2 (200p).
It is possible to make \[Sterling]2 in the following way:
1\[Times]\[Sterling]1 + 1\[Times]50p + 2\[Times]20p + 1\[Times]5p + 1\
\[Times]2p + 3\[Times]1p
How many different ways can \[Sterling]2 be made using any number of coins?\
\>", "Text",
CellGroupingRules->{"GroupTogetherGrouping", 10000.},
CellChangeTimes->{
3.825800785096339*^9, {3.8259952767425327`*^9, 3.82599530340602*^9}, {
3.8286676751977377`*^9, 3.8286676949327106`*^9}}],
Cell[BoxData[
StyleBox[
RowBox[{
RowBox[{"IntegerPartitions", "[",
RowBox[{"200", ",", "All", ",",
RowBox[{"{",
RowBox[{
"1", ",", "2", ",", "5", ",", "10", ",", "20", ",", "50", ",", "100",
",", "200"}], "}"}]}], "]"}], "//", "Length"}], "Code"]], "Code",
CellGroupingRules->{"GroupTogetherGrouping", 10000.},
CellChangeTimes->{{3.8258008038272123`*^9, 3.8258008082036495`*^9},
3.82599530340702*^9, 3.82599537860802*^9, {3.826926436526827*^9,
3.826926621795352*^9}, {3.8269266541365857`*^9, 3.8269266892090926`*^9}, {
3.8269268145986304`*^9, 3.8269270607342415`*^9}, {3.826928299701293*^9,
3.8269283428202934`*^9}, 3.826928506205293*^9, {3.8269286833582935`*^9,
3.8269286845422935`*^9}, {3.8269287505802183`*^9, 3.826928837364896*^9}, {
3.826928878735033*^9, 3.8269289242895875`*^9}, {3.826929187917948*^9,
3.8269291900451603`*^9}, {3.8269335712342405`*^9, 3.826933579920109*^9}, {
3.8269342002451353`*^9, 3.8269342948795977`*^9}, {3.826934453994508*^9,
3.826934484802588*^9}, {3.8269345278018875`*^9, 3.8269346025363607`*^9}, {
3.8269349797030735`*^9, 3.8269350310402064`*^9}, {3.8269351190500064`*^9,
3.826935152429344*^9}, {3.82693522929703*^9, 3.8269352573768377`*^9}, {
3.8269353290802565`*^9, 3.8269353642912564`*^9}, {3.8269358955142565`*^9,
3.826935922493352*^9}, {3.8269362234794474`*^9, 3.82693623760286*^9}, {
3.826936542273324*^9, 3.826936603461442*^9}, 3.826936663876483*^9,
3.8269371195460453`*^9, 3.826937420671155*^9, {3.826937498571944*^9,
3.826937542254312*^9}, {3.826937624536539*^9, 3.82693762894298*^9}, {
3.8269376778298683`*^9, 3.82693770204729*^9}, {3.826937807974881*^9,
3.8269378122343073`*^9}, {3.826937932014284*^9, 3.826937949174*^9},
3.828667679436161*^9, {3.8306382195848484`*^9, 3.8306382361707973`*^9},
3.8306384372943006`*^9, 3.8306384886302366`*^9, {3.8306385667287035`*^9,
3.8306385909880915`*^9}, {3.83063862313293*^9, 3.8306386625651855`*^9}, {
3.830644055201845*^9, 3.83064410805513*^9}, {3.830644184871811*^9,
3.830644302581581*^9}, {3.8308251560308704`*^9, 3.8308252044017067`*^9}, {
3.8308260348417425`*^9, 3.830826038355094*^9}, {3.830828602335476*^9,
3.8308286086701093`*^9}, {3.830829523439577*^9, 3.830829529125146*^9}, {
3.8308297186860995`*^9, 3.83082971888612*^9}, 3.8308326388450956`*^9, {
3.8308327440536156`*^9, 3.830832765280738*^9}}],
Cell[BoxData["73682"], "Output",
CellGroupingRules->{"GroupTogetherGrouping", 10000.},
CellChangeTimes->{{3.8308175167200017`*^9, 3.830817516994029*^9}, {
3.830825160069274*^9, 3.8308252064579124`*^9}, 3.8308260389031487`*^9,
3.8308286090631485`*^9, 3.830829529551188*^9, 3.8308297194541764`*^9,
3.8308327665778675`*^9, 3.830840969333494*^9, 3.833512129648385*^9,
3.8336047207823877`*^9, 3.8342957427360845`*^9}],
Cell["\:4e3e\:4f8b\:ff1a\:7528{1,3,4}\:520610", "Text",
CellGroupingRules->{"GroupTogetherGrouping", 10000.},
CellChangeTimes->{
3.825800785096339*^9, {3.8259952767425327`*^9, 3.82599530340602*^9}, {
3.8286676751977377`*^9, 3.8286676949327106`*^9}, 3.830832681860397*^9, {
3.8308327349607067`*^9, 3.830832736189829*^9}, {3.830832777033913*^9,
3.830832779561166*^9}}],
Cell[BoxData[
StyleBox[
RowBox[{"IntegerPartitions", "[",
RowBox[{"10", ",", "All", ",",
RowBox[{"{",
RowBox[{"1", ",", "3", ",", "4"}], "}"}]}], "]"}], "Code"]], "Code",
CellGroupingRules->{"GroupTogetherGrouping", 10000.},
CellChangeTimes->{3.8308327099302034`*^9, 3.833512129648385*^9}],
Cell[BoxData[
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{"4", ",", "4", ",", "1", ",", "1"}], "}"}], ",",
RowBox[{"{",
RowBox[{"4", ",", "3", ",", "3"}], "}"}], ",",
RowBox[{"{",
RowBox[{"4", ",", "3", ",", "1", ",", "1", ",", "1"}], "}"}], ",",
RowBox[{"{",
RowBox[{"4", ",", "1", ",", "1", ",", "1", ",", "1", ",", "1", ",", "1"}],
"}"}], ",",
RowBox[{"{",
RowBox[{"3", ",", "3", ",", "3", ",", "1"}], "}"}], ",",
RowBox[{"{",
RowBox[{"3", ",", "3", ",", "1", ",", "1", ",", "1", ",", "1"}], "}"}],
",",
RowBox[{"{",
RowBox[{
"3", ",", "1", ",", "1", ",", "1", ",", "1", ",", "1", ",", "1", ",",
"1"}], "}"}], ",",
RowBox[{"{",
RowBox[{
"1", ",", "1", ",", "1", ",", "1", ",", "1", ",", "1", ",", "1", ",", "1",
",", "1", ",", "1"}], "}"}]}], "}"}]], "Output",
CellGroupingRules->{"GroupTogetherGrouping", 10000.},
CellChangeTimes->{3.8308327108973007`*^9, 3.8308409693955*^9,
3.833512129648385*^9, 3.833604720859395*^9, 3.8342957430151124`*^9}],
Cell[TextData[{
"\:5206\:6790\:ff1a\:5bf9\:4e8e\:6bcf\:4e00\:6b21\:9012\:5f52\:90fd\:6709\
\:8fd9\:51e0\:79cd\:60c5\:51b5\:ff1a\:6700\:5927\:7684\:662f4 \:6700\:5927\
\:7684\:662f3 \:6700\:5927\:7684\:662f1\:ff0c\:5bf9\:4e8e\:6bcf\:4e00\:79cd\
\:60c5\:51b5\:ff0c\:5982\:679c\:5269\:4e0b\:7684\:94b1\:4ecd\:7136\:5217\:51fa\
\:4e0a\:8ff0\:60c5\:51b5\:3002\n\:6bd4\:5982\:6700\:5927\:7684\:662f4\:6765\
\:8bf4\:ff0c\:7b2c\:4e00\:6b21\:5206\:51fa4\:ff0c\:5269\:4e0b6\:ff0c\:5728\
\:4f59\:4e0b\:7684\:94b1\:4e0a\:7ee7\:7eed\:4e0a\:8ff0\:903b\:8f91\:4ecd\:7136\
\:53ef\:4ee5\:5206\:4e3a3\:79cd\:60c5\:51b5\:ff1a\:6700\:5927\:7684\:662f4 \
\:6700\:5927\:7684\:662f3 \:6700\:5927\:7684\:662f1 \:8fd9\:662f\:7b2c\:4e8c\
\:8f6e\n\:518d\:6b21\:62ff\:51fa4\:5c31\:53ea\:52692\:4e86\:ff0c\:628a2\:518d\
\:5206\:5c31\:53ea\:67091\:79cd\:60c5\:51b5\:ff1a\:6700\:5927\:7684\:662f1\
\:ff0c\:8fd9\:662f\:7b2c\:4e09\:8f6e\n\:53ef\:4ee5\:770b\:5230\:6bcf\:4e00\
\:8f6e\:7684\:903b\:8f91\:90fd\:4e00\:6837\:ff0c\:800c\:4e14\:4e0b\:4e00\:8f6e\
\:9700\:8981\:672c\:8f6e\:64cd\:4f5c\:7ed3\:679c\n \n4+6 ",
Cell[BoxData[
FormBox[
TagBox[GridBox[{
{"\[Piecewise]", GridBox[{
{
RowBox[{"4", "+", "2"}],
RowBox[{
RowBox[{"2", "\:53ea\:80fd\:75281\:5206\:6240\:4ee54"}], "+", "4",
"+", "2"}]},
{
RowBox[{"3", "+", "3"}],
TagBox[GridBox[{
{"\[Piecewise]", GridBox[{
{
RowBox[{"3", "+", "0"}],
RowBox[{
RowBox[{"0", "\:4e0d\:80fd\:518d\:5206\:6240\:4ee54"}], "+",
"3", "+", "3"}]},
{
RowBox[{"1", "+", "2"}],
RowBox[{
RowBox[{
"2", "\:75281\:6216\:4ee5\:4e0b\:96f6\:94b1\:53ea\:80fd\
\:51681\:6240\:4ee54"}], "+", "3", "+", "1", "+", "1", "+", "1"}]}
},
AllowedDimensions->{2, Automatic},
Editable->True,
GridBoxAlignment->{
"Columns" -> {{Left}}, "ColumnsIndexed" -> {},
"Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
GridBoxItemSize->{
"Columns" -> {{Automatic}}, "ColumnsIndexed" -> {},
"Rows" -> {{1.}}, "RowsIndexed" -> {}},
GridBoxSpacings->{"Columns" -> {
Offset[0.27999999999999997`], {
Offset[0.84]},
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {},
"Rows" -> {
Offset[0.2], {
Offset[0.4]},
Offset[0.2]}, "RowsIndexed" -> {}},
Selectable->True]}
},
GridBoxAlignment->{
"Columns" -> {{Left}}, "ColumnsIndexed" -> {},
"Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
GridBoxItemSize->{
"Columns" -> {{Automatic}}, "ColumnsIndexed" -> {},
"Rows" -> {{1.}}, "RowsIndexed" -> {}},
GridBoxSpacings->{"Columns" -> {
Offset[0.27999999999999997`], {
Offset[0.35]},
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
Offset[0.2], {
Offset[0.4]},
Offset[0.2]}, "RowsIndexed" -> {}}],
"Piecewise",
DeleteWithContents->True,
Editable->False,
SelectWithContents->True,
Selectable->False]},
{
RowBox[{"1", "+", "5"}],
RowBox[{
RowBox[{
"5", "\:75281\:6216\:4ee5\:4e0b\:96f6\:94b1\:53ea\:80fd\:51681",
" ", "\:6240\:4ee54"}], "+", "1", "+", "1", "+", "1", "+", "1",
"+", "1", "+", "1"}]}
},
AllowedDimensions->{2, Automatic},
Editable->True,
GridBoxAlignment->{
"Columns" -> {{Left}}, "ColumnsIndexed" -> {},
"Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
GridBoxItemSize->{
"Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}},
"RowsIndexed" -> {}},
GridBoxSpacings->{"Columns" -> {
Offset[0.27999999999999997`], {
Offset[0.84]},
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
Offset[0.2], {
Offset[0.4]},
Offset[0.2]}, "RowsIndexed" -> {}},
Selectable->True]}
},
GridBoxAlignment->{
"Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}},
"RowsIndexed" -> {}},
GridBoxItemSize->{
"Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}},
"RowsIndexed" -> {}},
GridBoxSpacings->{"Columns" -> {
Offset[0.27999999999999997`], {
Offset[0.35]},
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
Offset[0.2], {
Offset[0.4]},
Offset[0.2]}, "RowsIndexed" -> {}}],
"Piecewise",
DeleteWithContents->True,
Editable->False,
SelectWithContents->True,
Selectable->False], TraditionalForm]],
FormatType->"TraditionalForm"],
"\n3+7 ",
Cell[BoxData[
FormBox[
TagBox[GridBox[{
{"\[Piecewise]", GridBox[{
{
RowBox[{"3", "+", "4"}],
TagBox[GridBox[{
{"\[Piecewise]", GridBox[{
{
RowBox[{"3", "+", "1"}],
RowBox[{
RowBox[{
"1", "\:4e0d\:80fd\:518d\:5206\:4e86\:6240\:4ee5\:8fd9\:79cd\
\:8bf7\:51b5\:662f3"}], "+", "3", "+", "3", "+", "1"}]},
{
RowBox[{"1", "+", "3"}],
RowBox[{
RowBox[{
"3", "\:75281\:6216\:4ee5\:4e0b\:7684\:96f6\:94b1\:53ea\
\:80fd\:5206\:6210\:51681\:6240\:4ee5\:8fd9\:79cd\:60c5\:51b5\:662f3"}], "+",
"3", "+", "1", "+", "1", "+", "1", "+", "1"}]}
},
AllowedDimensions->{2, Automatic},
Editable->True,
GridBoxAlignment->{
"Columns" -> {{Left}}, "ColumnsIndexed" -> {},
"Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
GridBoxItemSize->{
"Columns" -> {{Automatic}}, "ColumnsIndexed" -> {},
"Rows" -> {{1.}}, "RowsIndexed" -> {}},
GridBoxSpacings->{"Columns" -> {
Offset[0.27999999999999997`], {
Offset[0.84]},
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {},
"Rows" -> {
Offset[0.2], {
Offset[0.4]},
Offset[0.2]}, "RowsIndexed" -> {}},
Selectable->True]}
},
GridBoxAlignment->{
"Columns" -> {{Left}}, "ColumnsIndexed" -> {},
"Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
GridBoxItemSize->{
"Columns" -> {{Automatic}}, "ColumnsIndexed" -> {},
"Rows" -> {{1.}}, "RowsIndexed" -> {}},
GridBoxSpacings->{"Columns" -> {
Offset[0.27999999999999997`], {
Offset[0.35]},
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
Offset[0.2], {
Offset[0.4]},
Offset[0.2]}, "RowsIndexed" -> {}}],
"Piecewise",
DeleteWithContents->True,
Editable->False,
SelectWithContents->True,
Selectable->False]},
{
RowBox[{"1", "+", "6"}],
RowBox[{
RowBox[{
"6", "\:75281\:6216\:4ee5\:4e0b\:96f6\:94b1\:53ea\:80fd\:5206\:6210\
\:51681\:6240\:4ee53"}], "+", "1", "+", "1", "+", "1", "+", "1", "+", "1",
"+", "1", "+", "1"}]}
},
AllowedDimensions->{2, Automatic},
Editable->True,
GridBoxAlignment->{
"Columns" -> {{Left}}, "ColumnsIndexed" -> {},
"Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
GridBoxItemSize->{
"Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}},
"RowsIndexed" -> {}},
GridBoxSpacings->{"Columns" -> {
Offset[0.27999999999999997`], {
Offset[0.84]},
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
Offset[0.2], {
Offset[0.4]},
Offset[0.2]}, "RowsIndexed" -> {}},
Selectable->True]}
},
GridBoxAlignment->{
"Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}},
"RowsIndexed" -> {}},
GridBoxItemSize->{
"Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}},
"RowsIndexed" -> {}},
GridBoxSpacings->{"Columns" -> {
Offset[0.27999999999999997`], {
Offset[0.35]},
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
Offset[0.2], {
Offset[0.4]},
Offset[0.2]}, "RowsIndexed" -> {}}],
"Piecewise",
DeleteWithContents->True,
Editable->False,
SelectWithContents->True,
Selectable->False], TraditionalForm]],
FormatType->"TraditionalForm"],
"\n1+9 \:7531\:4e8e\:53ea\:80fd\:75281\:5206\:6240\:4ee5\:8fd9\:91cc\:53ea\
\:6709\:4e00\:79cd\:60c5\:51b5\:5c31\:662f\:51681"
}], "Text",
CellGroupingRules->{"GroupTogetherGrouping", 10000.},
CellChangeTimes->{
3.825800785096339*^9, {3.8259952767425327`*^9, 3.82599530340602*^9}, {
3.8286676751977377`*^9, 3.8286676949327106`*^9}, {3.830817519337263*^9,
3.8308175216124907`*^9}, {3.8308247402802997`*^9, 3.830824753667638*^9}, {
3.830825345807846*^9, 3.8308253877360387`*^9}, {3.830825628233086*^9,
3.8308256292571883`*^9}, {3.8308282716086845`*^9, 3.830828328320077*^9}, {
3.8308318600926676`*^9, 3.8308320548607035`*^9}, {3.8308320903682537`*^9,
3.8308323442516394`*^9}, {3.8308323990461187`*^9, 3.830832689044115*^9}, {
3.8308327208963003`*^9, 3.8308327229815083`*^9}, {3.8308327920204115`*^9,
3.830832858348044*^9}, {3.830832892629472*^9, 3.8308332539636016`*^9}, {
3.830833420954299*^9, 3.830833468989102*^9}, {3.830833507520955*^9,
3.83083382210341*^9}, {3.8308338924194407`*^9, 3.8308339141876173`*^9}}],
Cell[BoxData[{
RowBox[{
RowBox[{"m", " ", ":=", " ",
RowBox[{"{",
RowBox[{"1", ",", "3", ",", "4"}], "}"}]}], ";"}], "\n",
RowBox[{
RowBox[{
RowBox[{"No31", "[",
RowBox[{"max_", ",", "remain_"}], "]"}], ":=",
RowBox[{"Module", "[",
RowBox[{
RowBox[{"{", "}"}], ",", "\n",
RowBox[{
RowBox[{"Print", "[", "max", "]"}], ";", "\n", "\t",
RowBox[{"If", "[",
RowBox[{
RowBox[{
RowBox[{"max", "\[Equal]", "1"}], " ", "||", " ",
RowBox[{"remain", " ", "<", " ", "max"}]}], ",", ",", "\n", "\t\t",
RowBox[{
RowBox[{"Scan", "[",
RowBox[{
RowBox[{
RowBox[{"No31", "[",
RowBox[{"#", ",",
RowBox[{"#", "-", "max"}]}], "]"}], "&"}], ",",
RowBox[{"Select", "[",
RowBox[{"m", ",",
RowBox[{
RowBox[{"#", "\[LessEqual]", "max"}], "&"}]}], "]"}]}], "]"}],
";"}]}], "\n", "\t", "]"}]}]}], "\n", "]"}]}], ";"}], "\n",
RowBox[{
RowBox[{"No31", "[",
RowBox[{"4", ",", "10"}], "]"}], ";"}]}], "Code",
CellGroupingRules->{"GroupTogetherGrouping", 10000.},
CellChangeTimes->{{3.8258008038272123`*^9, 3.8258008082036495`*^9},
3.82599530340702*^9, 3.82599537860802*^9, {3.826926436526827*^9,
3.826926621795352*^9}, {3.8269266541365857`*^9, 3.8269266892090926`*^9}, {
3.8269268145986304`*^9, 3.8269270607342415`*^9}, {3.826928299701293*^9,
3.8269283428202934`*^9}, 3.826928506205293*^9, {3.8269286833582935`*^9,
3.8269286845422935`*^9}, {3.8269287505802183`*^9, 3.826928837364896*^9}, {
3.826928878735033*^9, 3.8269289242895875`*^9}, {3.826929187917948*^9,
3.8269291900451603`*^9}, {3.8269335712342405`*^9, 3.826933579920109*^9}, {
3.8269342002451353`*^9, 3.8269342948795977`*^9}, {3.826934453994508*^9,
3.826934484802588*^9}, {3.8269345278018875`*^9, 3.8269346025363607`*^9}, {
3.8269349797030735`*^9, 3.8269350310402064`*^9}, {3.8269351190500064`*^9,
3.826935152429344*^9}, {3.82693522929703*^9, 3.8269352573768377`*^9}, {
3.8269353290802565`*^9, 3.8269353642912564`*^9}, {3.8269358955142565`*^9,
3.826935922493352*^9}, {3.8269362234794474`*^9, 3.82693623760286*^9}, {
3.826936542273324*^9, 3.826936603461442*^9}, 3.826936663876483*^9,
3.8269371195460453`*^9, 3.826937420671155*^9, {3.826937498571944*^9,
3.826937542254312*^9}, {3.826937624536539*^9, 3.82693762894298*^9}, {
3.8269376778298683`*^9, 3.82693770204729*^9}, {3.826937807974881*^9,
3.8269378122343073`*^9}, {3.826937932014284*^9, 3.826937949174*^9},
3.828667679436161*^9, {3.8306382195848484`*^9, 3.8306382361707973`*^9},
3.8306384372943006`*^9, 3.8306384886302366`*^9, {3.8306385667287035`*^9,
3.8306385909880915`*^9}, {3.83063862313293*^9, 3.8306386625651855`*^9}, {
3.830644055201845*^9, 3.83064410805513*^9}, {3.830644184871811*^9,
3.830644302581581*^9}, 3.8308175432566547`*^9, {3.8308244977450485`*^9,
3.8308246691981916`*^9}, {3.830824781138385*^9, 3.830824843620632*^9},
3.830824969758245*^9, {3.8308250000632753`*^9, 3.8308250103583045`*^9},
3.8308251768189487`*^9, {3.8308252094162083`*^9, 3.830825212615528*^9}, {
3.830825708131075*^9, 3.8308257215074124`*^9}, {3.830825755927854*^9,
3.830825786841945*^9}, {3.830825831853446*^9, 3.8308258358078413`*^9}, {
3.830826788528104*^9, 3.8308268094621973`*^9}, 3.8308270044546947`*^9,
3.8308273585380993`*^9, 3.8308314522616673`*^9, {3.8308339965768557`*^9,
3.830834094784675*^9}, {3.830834183556552*^9, 3.8308341843256283`*^9}, {
3.8308342603912344`*^9, 3.8308342700401993`*^9}, {3.830834309586153*^9,
3.8308343541136055`*^9}, {3.8308344040185957`*^9, 3.830834414374631*^9}, {
3.830834464180611*^9, 3.8308345557567677`*^9}, {3.8308345948106728`*^9,
3.830834630642256*^9}, {3.830840986536214*^9, 3.830840991976758*^9}, {
3.8308410278223424`*^9, 3.8308410757081304`*^9}}],
Cell[BoxData["4"], "Print",
CellGroupingRules->{"GroupTogetherGrouping", 10000.},
CellChangeTimes->{{3.8308410718797474`*^9, 3.8308410767582355`*^9},
3.833512129648385*^9, 3.833604720919401*^9, 3.834295743073118*^9}],
Cell[BoxData["1"], "Print",
CellGroupingRules->{"GroupTogetherGrouping", 10000.},
CellChangeTimes->{{3.8308410718797474`*^9, 3.8308410767582355`*^9},
3.833512129648385*^9, 3.833604720919401*^9, 3.8342957430771184`*^9}],
Cell[BoxData["3"], "Print",
CellGroupingRules->{"GroupTogetherGrouping", 10000.},
CellChangeTimes->{{3.8308410718797474`*^9, 3.8308410767582355`*^9},
3.833512129648385*^9, 3.833604720919401*^9, 3.8342957430791187`*^9}],
Cell[BoxData["4"], "Print",
CellGroupingRules->{"GroupTogetherGrouping", 10000.},
CellChangeTimes->{{3.8308410718797474`*^9, 3.8308410767582355`*^9},
3.833512129648385*^9, 3.833604720919401*^9, 3.834295743082119*^9}]
}, Open ]],
Cell[CellGroupData[{
Cell["\[FilledSquare]32. Pandigital products", "Subsubsection",
CellChangeTimes->{
3.82580077140097*^9, {3.825995270185877*^9, 3.8259952717480335`*^9},
3.82599530340602*^9, {3.828667656163834*^9, 3.8286676703462524`*^9}, {
3.833512172233643*^9, 3.8335122348629055`*^9}}],
Cell["\<\
We shall say that an n-digit number is pandigital if it makes use of all the \
digits 1 to n exactly once; for example, the 5-digit number, 15234, is 1 \
through 5 pandigital.
The product 7254 is unusual, as the identity, 39 \[Times] 186 = 7254, \
containing multiplicand, multiplier, and product is 1 through 9 pandigital.
Find the sum of all products whose multiplicand/multiplier/product identity \
can be written as a 1 through 9 pandigital.
HINT: Some products can be obtained in more than one way so be sure to only \
include it once in your sum.\
\>", "Text",
CellChangeTimes->{
3.825800785096339*^9, {3.8259952767425327`*^9, 3.82599530340602*^9}, {
3.8286676751977377`*^9, 3.8286676949327106`*^9}, {3.833512172233643*^9,
3.833512202019621*^9}, {3.8335122396143804`*^9, 3.8335122440158205`*^9}}],
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{
RowBox[{"(*",
RowBox[{"\:4e58\:6cd5\:7ed3\:679c\:5fc5\:7136\:662f4\:4f4d\:6570", ",",
RowBox[{
RowBox[{"1", "~", "9"}],
"\:7ec4\:6210\:4e0d\:91cd\:590d\:76844\:4f4d\:6570\:67093024\:79cd"}]}],
"*)"}], "\n",
RowBox[{
RowBox[{"FromDigits", "/@",
RowBox[{"Permutations", "[",
RowBox[{
RowBox[{"{",
RowBox[{
"1", ",", "2", ",", "3", ",", "4", ",", "5", ",", "6", ",", "7", ",",
"8", ",", "9"}], "}"}], ",",
RowBox[{"{", "4", "}"}]}], "]"}]}], "//", "Length"}]}]], "Code",
CellChangeTimes->{3.8339257066854935`*^9}],
Cell[BoxData["3024"], "Output",
CellChangeTimes->{3.8339257080956345`*^9, 3.8342957430971203`*^9}]
}, Open ]],
Cell[CellGroupData[{
Cell[BoxData[{
RowBox[{
RowBox[{
RowBox[{"IntegersUnion", "[",
RowBox[{"a_", ",", "c_"}], "]"}], " ", ":=",
RowBox[{"Module", "[",
RowBox[{
RowBox[{"{", "}"}], ",",
RowBox[{"If", "[",
RowBox[{
RowBox[{"Divisible", "[",
RowBox[{"c", ",", "a"}], "]"}], ",",
RowBox[{"Union", "[",
RowBox[{
RowBox[{"IntegerDigits", "[", "c", "]"}], ",",
RowBox[{"IntegerDigits", "[", "a", "]"}], ",",
RowBox[{"IntegerDigits", "[",
RowBox[{
RowBox[{"(",
RowBox[{"c", "/", "a"}], ")"}], "//", "IntegerPart"}], "]"}]}],
"]"}], ",",
RowBox[{"{", "}"}]}], "]"}]}], "]"}]}], ";"}], "\n",
RowBox[{
RowBox[{
RowBox[{
RowBox[{"f32", "[", "c_", "]"}], ":=", " ",
RowBox[{"Module", "[",
RowBox[{
RowBox[{"{", "}"}], ",",
RowBox[{"Catch", "[",
RowBox[{"Scan", "[",
RowBox[{
RowBox[{
RowBox[{"(",
RowBox[{
RowBox[{"If", "[",
RowBox[{
RowBox[{
RowBox[{"IntegersUnion", "[",
RowBox[{"#", ",", "c"}], "]"}], "==",
RowBox[{"{",
RowBox[{
"1", ",", "2", ",", "3", ",", "4", ",", "5", ",", "6", ",",
"7", ",", "8", ",", "9"}], "}"}]}], ",",
RowBox[{"Throw", "[", "c", "]"}]}], "]"}], ";",
RowBox[{"If", "[",
RowBox[{
RowBox[{"#", "\[Equal]", "999"}], ",",
RowBox[{"Throw", "[",
RowBox[{"{", "}"}], "]"}]}], "]"}]}], ")"}], "&"}], ",",
RowBox[{"Range", "[",
RowBox[{"1", ",", "999"}], "]"}]}], "]"}], "]"}]}], "]"}]}], ";"}],
"\n",
RowBox[{"(*",
RowBox[{
RowBox[{
RowBox[{"a", "*", "b"}], "=", "c"}], ",",
"\:67093024\:79cdC\:8ba9\:516c\:5f0f\:6210\:7acb", "\:ff0c",
"\:5bf9\:4e8e\:6bcf\:4e00\:4e2a", "\:ff0c",
"a\:6216b\:6700\:5927\:4f4d\:6570\:662f3\:6700\:5c0f\:4f4d\:6570\:662f1",
"\:ff0c",
RowBox[{"\:90a3\:4e48\:6bd4\:5982a\:53ef\:4ee5\:53d61", "~", "999"}]}],
"*)"}]}], "\n",
RowBox[{
RowBox[{"result", " ", "=", " ",
RowBox[{"{", "}"}]}], ";"}], "\n",
RowBox[{
RowBox[{"Scan", "[",
RowBox[{
RowBox[{
RowBox[{"AppendTo", "[",
RowBox[{"result", ",",
RowBox[{"f32", "[", "#", "]"}]}], "]"}], "&"}], ",",
RowBox[{"FromDigits", "/@",
RowBox[{"Permutations", "[",
RowBox[{
RowBox[{"{",
RowBox[{
"1", ",", "2", ",", "3", ",", "4", ",", "5", ",", "6", ",", "7", ",",
"8", ",", "9"}], "}"}], ",",
RowBox[{"{", "4", "}"}]}], "]"}]}]}], "]"}], ";"}], "\n",
RowBox[{"result", "//", "Flatten"}]}], "Code",
CellChangeTimes->{{3.8258008038272123`*^9, 3.8258008082036495`*^9},
3.82599530340702*^9, 3.82599537860802*^9, {3.826926436526827*^9,
3.826926621795352*^9}, {3.8269266541365857`*^9, 3.8269266892090926`*^9}, {
3.8269268145986304`*^9, 3.8269270607342415`*^9}, {3.826928299701293*^9,
3.8269283428202934`*^9}, 3.826928506205293*^9, {3.8269286833582935`*^9,
3.8269286845422935`*^9}, {3.8269287505802183`*^9, 3.826928837364896*^9}, {
3.826928878735033*^9, 3.8269289242895875`*^9}, {3.826929187917948*^9,
3.8269291900451603`*^9}, {3.8269335712342405`*^9, 3.826933579920109*^9}, {
3.8269342002451353`*^9, 3.8269342948795977`*^9}, {3.826934453994508*^9,
3.826934484802588*^9}, {3.8269345278018875`*^9, 3.8269346025363607`*^9}, {
3.8269349797030735`*^9, 3.8269350310402064`*^9}, {3.8269351190500064`*^9,
3.826935152429344*^9}, {3.82693522929703*^9, 3.8269352573768377`*^9}, {
3.8269353290802565`*^9, 3.8269353642912564`*^9}, {3.8269358955142565`*^9,
3.826935922493352*^9}, {3.8269362234794474`*^9, 3.82693623760286*^9}, {
3.826936542273324*^9, 3.826936603461442*^9}, 3.826936663876483*^9,
3.8269371195460453`*^9, 3.826937420671155*^9, {3.826937498571944*^9,
3.826937542254312*^9}, {3.826937624536539*^9, 3.82693762894298*^9}, {
3.8269376778298683`*^9, 3.82693770204729*^9}, {3.826937807974881*^9,
3.8269378122343073`*^9}, {3.826937932014284*^9, 3.826937949174*^9},
3.828667679436161*^9, {3.8306382195848484`*^9, 3.8306382361707973`*^9},
3.8306384372943006`*^9, 3.8306384886302366`*^9, {3.8306385667287035`*^9,
3.8306385909880915`*^9}, {3.83063862313293*^9, 3.8306386625651855`*^9}, {
3.830644055201845*^9, 3.83064410805513*^9}, {3.830644184871811*^9,
3.830644302581581*^9}, {3.8308251560308704`*^9, 3.8308252044017067`*^9}, {
3.8308260348417425`*^9, 3.830826038355094*^9}, {3.830828602335476*^9,
3.8308286086701093`*^9}, {3.830829523439577*^9, 3.830829529125146*^9}, {
3.8308297186860995`*^9, 3.83082971888612*^9}, 3.8308326388450956`*^9, {
3.8308327440536156`*^9, 3.830832765280738*^9}, {3.833512172233643*^9,
3.833512202019621*^9}, {3.833604524904802*^9, 3.8336046201993303`*^9}, {
3.833604702937603*^9, 3.833604718715181*^9}, {3.8336047878680954`*^9,
3.8336048108103895`*^9}, {3.833604878254133*^9, 3.8336049760219088`*^9}, {
3.833605216972719*^9, 3.8336052518412056`*^9}, {3.8336054142336273`*^9,
3.833605434672671*^9}, {3.8336054748356867`*^9, 3.833605497339937*^9}, {
3.8336055605572577`*^9, 3.8336055883210344`*^9}, {3.833925519060733*^9,
3.83392563494732*^9}, {3.8339256778446093`*^9, 3.8339257775235767`*^9}, {
3.8339261505118713`*^9, 3.8339264109959173`*^9}, {3.833926471390956*^9,
3.833926554307247*^9}, {3.8339273152773457`*^9, 3.833927315909409*^9}, {
3.8339273608048983`*^9, 3.83392743153197*^9}, {3.833927489883805*^9,
3.83392758474329*^9}, {3.833933212594023*^9, 3.8339332156143255`*^9}, {
3.833933390849847*^9, 3.8339336839281683`*^9}, {3.833933724032178*^9,
3.8339337332130957`*^9}, {3.8339341346672106`*^9, 3.833934147433211*^9}, {
3.8339341919622107`*^9, 3.833934222918211*^9}, {3.833934256743211*^9,
3.8339343411327105`*^9}, 3.833934485216821*^9, {3.833934519061205*^9,
3.8339345597372723`*^9}, {3.83393461703401*^9, 3.8339346618794937`*^9}, {
3.833934882863801*^9, 3.8339348900275173`*^9}, {3.8339350037428875`*^9,
3.8339350189784107`*^9}, {3.833935051450658*^9, 3.833935056433156*^9}, {
3.8339351112236347`*^9, 3.8339351179733095`*^9}, 3.8339352092064314`*^9, {
3.8339359273994617`*^9, 3.833935949909713*^9}, {3.8339359988346043`*^9,
3.833936018429564*^9}, {3.833936056173338*^9, 3.83393606109083*^9},
3.8339361516906185`*^9, {3.833936991809622*^9, 3.8339371174932194`*^9}}],
Cell[BoxData["$Aborted"], "Output",
CellChangeTimes->{3.8339359790956306`*^9, 3.8339360456712875`*^9,
3.8339360882725477`*^9, 3.8339361808425336`*^9, 3.8339371215356236`*^9,
3.8339371575962296`*^9, 3.8342957528330936`*^9}],
Cell[BoxData[
RowBox[{"{",
RowBox[{"4396", ",", "5346", ",", "5796", ",", "6952"}], "}"}]], "Output",
CellChangeTimes->{3.8339359790956306`*^9, 3.8339360456712875`*^9,
3.8339360882725477`*^9, 3.8339361808425336`*^9, 3.8339371215356236`*^9,
3.8339371575962296`*^9, 3.8342957528360944`*^9}]
}, Open ]],
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"Total", "[", "%", "]"}]], "Code",
CellChangeTimes->{{3.8339371778512545`*^9, 3.8339371815216217`*^9}}],
Cell[BoxData["45228"], "Output",
CellChangeTimes->{3.833937182085678*^9}]
}, Open ]]
}, Open ]],
Cell[CellGroupData[{
Cell["\[FilledSquare]33. Digit cancelling fractions", "Subsubsection",
CellChangeTimes->{
3.82580077140097*^9, {3.825995270185877*^9, 3.8259952717480335`*^9},
3.82599530340602*^9, {3.828667656163834*^9, 3.8286676703462524`*^9}, {
3.833512172233643*^9, 3.833512202019621*^9}, {3.8335122468091*^9,
3.8335122480292215`*^9}, {3.8339372134308176`*^9, 3.8339372147599506`*^9}}],
Cell["\<\
The fraction 49/98 is a curious fraction, as an inexperienced mathematician \
in attempting to simplify it may incorrectly believe that 49/98 = 4/8, which \
is correct, is obtained by cancelling the 9s.
We shall consider fractions like, 30/50 = 3/5, to be trivial examples.
There are exactly four non-trivial examples of this type of fraction, less \
than one in value, and containing two digits in the numerator and denominator.
If the product of these four fractions is given in its lowest common terms, \
find the value of the denominator.\
\>", "Text",
CellChangeTimes->{
3.825800785096339*^9, {3.8259952767425327`*^9, 3.82599530340602*^9}, {
3.8286676751977377`*^9, 3.8286676949327106`*^9}, {3.833512172233643*^9,
3.833512202019621*^9}, {3.8339372205695314`*^9, 3.833937233008775*^9}}],
Cell[CellGroupData[{
Cell[BoxData["\:4e0d\:4f1a"], "Code",
CellChangeTimes->{{3.8258008038272123`*^9, 3.8258008082036495`*^9},
3.82599530340702*^9, 3.82599537860802*^9, {3.826926436526827*^9,
3.826926621795352*^9}, {3.8269266541365857`*^9, 3.8269266892090926`*^9}, {
3.8269268145986304`*^9, 3.8269270607342415`*^9}, {3.826928299701293*^9,
3.8269283428202934`*^9}, 3.826928506205293*^9, {3.8269286833582935`*^9,
3.8269286845422935`*^9}, {3.8269287505802183`*^9, 3.826928837364896*^9}, {
3.826928878735033*^9, 3.8269289242895875`*^9}, {3.826929187917948*^9,
3.8269291900451603`*^9}, {3.8269335712342405`*^9, 3.826933579920109*^9}, {
3.8269342002451353`*^9, 3.8269342948795977`*^9}, {3.826934453994508*^9,
3.826934484802588*^9}, {3.8269345278018875`*^9, 3.8269346025363607`*^9}, {
3.8269349797030735`*^9, 3.8269350310402064`*^9}, {3.8269351190500064`*^9,
3.826935152429344*^9}, {3.82693522929703*^9, 3.8269352573768377`*^9}, {
3.8269353290802565`*^9, 3.8269353642912564`*^9}, {3.8269358955142565`*^9,
3.826935922493352*^9}, {3.8269362234794474`*^9, 3.82693623760286*^9}, {
3.826936542273324*^9, 3.826936603461442*^9}, 3.826936663876483*^9,
3.8269371195460453`*^9, 3.826937420671155*^9, {3.826937498571944*^9,
3.826937542254312*^9}, {3.826937624536539*^9, 3.82693762894298*^9}, {
3.8269376778298683`*^9, 3.82693770204729*^9}, {3.826937807974881*^9,
3.8269378122343073`*^9}, {3.826937932014284*^9, 3.826937949174*^9},
3.828667679436161*^9, {3.8306382195848484`*^9, 3.8306382361707973`*^9},
3.8306384372943006`*^9, 3.8306384886302366`*^9, {3.8306385667287035`*^9,
3.8306385909880915`*^9}, {3.83063862313293*^9, 3.8306386625651855`*^9}, {
3.830644055201845*^9, 3.83064410805513*^9}, {3.830644184871811*^9,
3.830644302581581*^9}, {3.8308251560308704`*^9, 3.8308252044017067`*^9}, {
3.8308260348417425`*^9, 3.830826038355094*^9}, {3.830828602335476*^9,
3.8308286086701093`*^9}, {3.830829523439577*^9, 3.830829529125146*^9}, {
3.8308297186860995`*^9, 3.83082971888612*^9}, 3.8308326388450956`*^9, {
3.8308327440536156`*^9, 3.830832765280738*^9}, {3.833512172233643*^9,
3.833512202019621*^9}, 3.8339438593076167`*^9, {3.834027324360879*^9,
3.834027394623904*^9}, {3.834027433455787*^9, 3.8340274991853595`*^9},
3.8340281572836123`*^9, {3.8340283154184246`*^9, 3.834028324589341*^9}}],
Cell[BoxData["True"], "Output",
CellChangeTimes->{3.834028158211705*^9, 3.834028318246707*^9}]
}, Open ]]
}, Open ]],
Cell[CellGroupData[{
Cell["\[FilledSquare]34. Digit factorials", "Subsubsection",
CellChangeTimes->{
3.82580077140097*^9, {3.825995270185877*^9, 3.8259952717480335`*^9},
3.82599530340602*^9, {3.828667656163834*^9, 3.8286676703462524`*^9}, {
3.833512172233643*^9, 3.833512202019621*^9}, {3.8335122468091*^9,
3.8335122480292215`*^9}, {3.8339372134308176`*^9,
3.8339372147599506`*^9}, {3.8340283754644303`*^9, 3.8340283863845224`*^9}}],
Cell["\<\
145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 120 = 145.
Find the sum of all numbers which are equal to the sum of the factorial of \
their digits.
Note: As 1! = 1 and 2! = 2 are not sums they are not included.\
\>", "Text",
CellChangeTimes->{
3.825800785096339*^9, {3.8259952767425327`*^9, 3.82599530340602*^9}, {
3.8286676751977377`*^9, 3.8286676949327106`*^9}, {3.833512172233643*^9,
3.833512202019621*^9}, {3.8339372205695314`*^9, 3.833937233008775*^9}, {
3.8340283843173156`*^9, 3.8340283941883025`*^9}}],
Cell[BoxData[
RowBox[{
RowBox[{
RowBox[{"9", "!"}], "*", "7"}], "==", "2540160",
RowBox[{"(*", "\:4e0a\:9650", "*)"}]}]], "Code",
CellChangeTimes->{{3.834028967836715*^9, 3.834029000678715*^9}}],
Cell[CellGroupData[{
Cell[BoxData[{
RowBox[{
RowBox[{
RowBox[{"CuriousQ", "[", "n_", "]"}], ":=",
RowBox[{"Module", "[",
RowBox[{
RowBox[{"{", "}"}], ",", "\n", "\t",
RowBox[{"If", "[",
RowBox[{
RowBox[{
RowBox[{"(",
RowBox[{
RowBox[{
RowBox[{"IntegerDigits", "[", "n", "]"}], "!"}], "//", "Total"}],
")"}], " ", "\[Equal]", " ", "n"}], ",", "n", ",", "0"}], "]"}]}],
"\n", "]"}]}], ";"}], "\n",
RowBox[{
RowBox[{"CuriousQ", "/@",
RowBox[{"Range", "[",
RowBox[{"3", ",", "2540160"}], "]"}]}], "//", "Total"}]}], "Code",
CellChangeTimes->{{3.8258008038272123`*^9, 3.8258008082036495`*^9},
3.82599530340702*^9, 3.82599537860802*^9, {3.826926436526827*^9,
3.826926621795352*^9}, {3.8269266541365857`*^9, 3.8269266892090926`*^9}, {
3.8269268145986304`*^9, 3.8269270607342415`*^9}, {3.826928299701293*^9,
3.8269283428202934`*^9}, 3.826928506205293*^9, {3.8269286833582935`*^9,
3.8269286845422935`*^9}, {3.8269287505802183`*^9, 3.826928837364896*^9}, {
3.826928878735033*^9, 3.8269289242895875`*^9}, {3.826929187917948*^9,
3.8269291900451603`*^9}, {3.8269335712342405`*^9, 3.826933579920109*^9}, {
3.8269342002451353`*^9, 3.8269342948795977`*^9}, {3.826934453994508*^9,
3.826934484802588*^9}, {3.8269345278018875`*^9, 3.8269346025363607`*^9}, {
3.8269349797030735`*^9, 3.8269350310402064`*^9}, {3.8269351190500064`*^9,
3.826935152429344*^9}, {3.82693522929703*^9, 3.8269352573768377`*^9}, {
3.8269353290802565`*^9, 3.8269353642912564`*^9}, {3.8269358955142565`*^9,
3.826935922493352*^9}, {3.8269362234794474`*^9, 3.82693623760286*^9}, {
3.826936542273324*^9, 3.826936603461442*^9}, 3.826936663876483*^9,
3.8269371195460453`*^9, 3.826937420671155*^9, {3.826937498571944*^9,
3.826937542254312*^9}, {3.826937624536539*^9, 3.82693762894298*^9}, {
3.8269376778298683`*^9, 3.82693770204729*^9}, {3.826937807974881*^9,
3.8269378122343073`*^9}, {3.826937932014284*^9, 3.826937949174*^9},
3.828667679436161*^9, {3.8306382195848484`*^9, 3.8306382361707973`*^9},
3.8306384372943006`*^9, 3.8306384886302366`*^9, {3.8306385667287035`*^9,
3.8306385909880915`*^9}, {3.83063862313293*^9, 3.8306386625651855`*^9}, {
3.830644055201845*^9, 3.83064410805513*^9}, {3.830644184871811*^9,
3.830644302581581*^9}, {3.8308251560308704`*^9, 3.8308252044017067`*^9}, {
3.8308260348417425`*^9, 3.830826038355094*^9}, {3.830828602335476*^9,
3.8308286086701093`*^9}, {3.830829523439577*^9, 3.830829529125146*^9}, {
3.8308297186860995`*^9, 3.83082971888612*^9}, 3.8308326388450956`*^9, {
3.8308327440536156`*^9, 3.830832765280738*^9}, {3.833512172233643*^9,
3.833512202019621*^9}, 3.8339438593076167`*^9, {3.834027324360879*^9,
3.834027394623904*^9}, {3.834027433455787*^9, 3.8340274991853595`*^9},
3.8340281572836123`*^9, {3.8340283154184246`*^9, 3.834028324589341*^9}, {
3.834028402031087*^9, 3.8340284089907827`*^9}, {3.834028482799165*^9,
3.834028523415226*^9}, {3.8340285877516594`*^9, 3.8340286361434975`*^9}, {
3.834028741665062*^9, 3.8340287476056557`*^9}, {3.834028794551715*^9,
3.834028864792715*^9}, {3.8340289154607153`*^9, 3.8340289314377155`*^9},
3.834028966372715*^9, {3.8340290823887153`*^9, 3.8340291719917154`*^9}, {
3.83402948182408*^9, 3.8340295456304617`*^9}}],
Cell[BoxData["40730"], "Output",
CellChangeTimes->{3.8340295713850374`*^9}]
}, Open ]]
}, Open ]],
Cell[CellGroupData[{
Cell["\[FilledSquare]35. Circular primes", "Subsubsection",
CellChangeTimes->{
3.82580077140097*^9, {3.825995270185877*^9, 3.8259952717480335`*^9},
3.82599530340602*^9, {3.828667656163834*^9, 3.8286676703462524`*^9}, {
3.833512172233643*^9, 3.833512202019621*^9}, {3.8335122468091*^9,
3.8335122480292215`*^9}, {3.8339372134308176`*^9,
3.8339372147599506`*^9}, {3.8340283754644303`*^9,
3.8340283863845224`*^9}, {3.8340295943683357`*^9, 3.8340296064345417`*^9}}],
Cell["\<\
The number, 197, is called a circular prime because all rotations of the \
digits: 197, 971, and 719, are themselves prime.
There are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, \
73, 79, and 97.
How many circular primes are there below one million?\
\>", "Text",
CellChangeTimes->{
3.825800785096339*^9, {3.8259952767425327`*^9, 3.82599530340602*^9}, {
3.8286676751977377`*^9, 3.8286676949327106`*^9}, {3.833512172233643*^9,
3.833512202019621*^9}, {3.8339372205695314`*^9, 3.833937233008775*^9}, {
3.8340283843173156`*^9, 3.8340283941883025`*^9}, {3.8340296108909874`*^9,
3.834029615935492*^9}}],
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{
RowBox[{"Partition", "[",
RowBox[{
RowBox[{"{",
RowBox[{"1", ",", "2", ",", "3", ",", "4"}], "}"}], ",", "3", ",", "1",
",", "1"}], "]"}],
RowBox[{"(*", "\:5faa\:73afpartition", "*)"}]}]], "Code",
CellChangeTimes->{{3.834030525368428*^9, 3.8340305406309547`*^9}}],
Cell[BoxData[
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{"1", ",", "2", ",", "3"}], "}"}], ",",
RowBox[{"{",
RowBox[{"2", ",", "3", ",", "4"}], "}"}], ",",
RowBox[{"{",
RowBox[{"3", ",", "4", ",", "1"}], "}"}], ",",
RowBox[{"{",
RowBox[{"4", ",", "1", ",", "2"}], "}"}]}], "}"}]], "Output",
CellChangeTimes->{3.8340305433142223`*^9}]
}, Open ]],
Cell[CellGroupData[{
Cell[BoxData[{
RowBox[{
RowBox[{
RowBox[{"CircularPrimeQ", "[", "n_", "]"}], ":=",
RowBox[{"Module", "[",
RowBox[{
RowBox[{"{", "}"}], ",", "\n", "\t",
RowBox[{"AllTrue", "[",
RowBox[{
RowBox[{"FromDigits", "/@",
RowBox[{"Partition", "[",
RowBox[{
RowBox[{"IntegerDigits", "[", "n", "]"}], ",",
RowBox[{
RowBox[{"IntegerDigits", "[", "n", "]"}], "//", "Length"}], ",",
"1", ",", "1"}], "]"}]}], ",", "PrimeQ"}], "]"}]}], "\n", "]"}]}],
";"}], "\n",
RowBox[{"Count", "[",
RowBox[{
RowBox[{"CircularPrimeQ", "/@",
RowBox[{"Range", "[", "1000000", "]"}]}], ",", "True"}], "]"}]}], "Code",
CellChangeTimes->{{3.8258008038272123`*^9, 3.8258008082036495`*^9},
3.82599530340702*^9, 3.82599537860802*^9, {3.826926436526827*^9,
3.826926621795352*^9}, {3.8269266541365857`*^9, 3.8269266892090926`*^9}, {
3.8269268145986304`*^9, 3.8269270607342415`*^9}, {3.826928299701293*^9,
3.8269283428202934`*^9}, 3.826928506205293*^9, {3.8269286833582935`*^9,
3.8269286845422935`*^9}, {3.8269287505802183`*^9, 3.826928837364896*^9}, {
3.826928878735033*^9, 3.8269289242895875`*^9}, {3.826929187917948*^9,
3.8269291900451603`*^9}, {3.8269335712342405`*^9, 3.826933579920109*^9}, {
3.8269342002451353`*^9, 3.8269342948795977`*^9}, {3.826934453994508*^9,
3.826934484802588*^9}, {3.8269345278018875`*^9, 3.8269346025363607`*^9}, {
3.8269349797030735`*^9, 3.8269350310402064`*^9}, {3.8269351190500064`*^9,
3.826935152429344*^9}, {3.82693522929703*^9, 3.8269352573768377`*^9}, {
3.8269353290802565`*^9, 3.8269353642912564`*^9}, {3.8269358955142565`*^9,
3.826935922493352*^9}, {3.8269362234794474`*^9, 3.82693623760286*^9}, {
3.826936542273324*^9, 3.826936603461442*^9}, 3.826936663876483*^9,
3.8269371195460453`*^9, 3.826937420671155*^9, {3.826937498571944*^9,
3.826937542254312*^9}, {3.826937624536539*^9, 3.82693762894298*^9}, {
3.8269376778298683`*^9, 3.82693770204729*^9}, {3.826937807974881*^9,
3.8269378122343073`*^9}, {3.826937932014284*^9, 3.826937949174*^9},
3.828667679436161*^9, {3.8306382195848484`*^9, 3.8306382361707973`*^9},
3.8306384372943006`*^9, 3.8306384886302366`*^9, {3.8306385667287035`*^9,
3.8306385909880915`*^9}, {3.83063862313293*^9, 3.8306386625651855`*^9}, {
3.830644055201845*^9, 3.83064410805513*^9}, {3.830644184871811*^9,
3.830644302581581*^9}, {3.8308251560308704`*^9, 3.8308252044017067`*^9}, {
3.8308260348417425`*^9, 3.830826038355094*^9}, {3.830828602335476*^9,
3.8308286086701093`*^9}, {3.830829523439577*^9, 3.830829529125146*^9}, {
3.8308297186860995`*^9, 3.83082971888612*^9}, 3.8308326388450956`*^9, {
3.8308327440536156`*^9, 3.830832765280738*^9}, {3.833512172233643*^9,
3.833512202019621*^9}, 3.8339438593076167`*^9, {3.834027324360879*^9,
3.834027394623904*^9}, {3.834027433455787*^9, 3.8340274991853595`*^9},
3.8340281572836123`*^9, {3.8340283154184246`*^9, 3.834028324589341*^9}, {
3.834028402031087*^9, 3.8340284089907827`*^9}, {3.834028482799165*^9,
3.834028523415226*^9}, {3.8340285877516594`*^9, 3.8340286361434975`*^9}, {
3.834028741665062*^9, 3.8340287476056557`*^9}, {3.834028794551715*^9,
3.834028864792715*^9}, {3.8340289154607153`*^9, 3.8340289314377155`*^9},
3.834028966372715*^9, {3.8340290823887153`*^9, 3.8340291719917154`*^9}, {
3.83402948182408*^9, 3.8340295456304617`*^9}, {3.8340296727951775`*^9,
3.834029681248022*^9}, {3.8340298187107677`*^9, 3.8340298444723434`*^9}, {
3.834030395162409*^9, 3.8340305199258842`*^9}, 3.834030566124503*^9, {
3.8340305987997704`*^9, 3.8340307476976585`*^9}, {3.8340307838152704`*^9,
3.8340308858565655`*^9}, {3.8340309252875137`*^9, 3.834030955574542*^9}, {
3.834031043653349*^9, 3.8340310599799814`*^9}}],
Cell[BoxData["55"], "Output",
CellChangeTimes->{
3.8340295713850374`*^9, {3.8340304074196343`*^9, 3.8340305140012913`*^9}, {
3.8340306364025307`*^9, 3.8340307482117105`*^9}, {3.834030839424923*^9,
3.834030847091689*^9}, {3.8340308814501247`*^9, 3.834030942193204*^9}, {
3.834031050239007*^9, 3.834031077399723*^9}}]
}, Open ]]
}, Open ]],
Cell[CellGroupData[{
Cell["\[FilledSquare]36. Double-base palindromes", "Subsubsection",
CellChangeTimes->{
3.82580077140097*^9, {3.825995270185877*^9, 3.8259952717480335`*^9},
3.82599530340602*^9, {3.828667656163834*^9, 3.8286676703462524`*^9}, {
3.833512172233643*^9, 3.833512202019621*^9}, {3.8335122468091*^9,
3.8335122480292215`*^9}, {3.8339372134308176`*^9,
3.8339372147599506`*^9}, {3.8340283754644303`*^9,
3.8340283863845224`*^9}, {3.8340295943683357`*^9,
3.8340296064345417`*^9}, {3.8340311250985017`*^9, 3.8340311271757092`*^9}}],
Cell[TextData[{
"The decimal number, 585 = ",
Cell[BoxData[
FormBox[
SubscriptBox["1001001001", "2"], TraditionalForm]],
FormatType->"TraditionalForm"],
" (binary), is palindromic in both bases.\nFind the sum of all numbers, less \
than one million, which are palindromic in base 10 and base 2.\n(Please note \
that the palindromic number, in either base, may not include leading zeros.)"
}], "Text",
CellChangeTimes->{
3.825800785096339*^9, {3.8259952767425327`*^9, 3.82599530340602*^9}, {
3.8286676751977377`*^9, 3.8286676949327106`*^9}, {3.833512172233643*^9,
3.833512202019621*^9}, {3.8339372205695314`*^9, 3.833937233008775*^9}, {
3.8340283843173156`*^9, 3.8340283941883025`*^9}, {3.8340296108909874`*^9,
3.834029615935492*^9}, {3.834031133095301*^9, 3.834031137651757*^9}, {
3.8340314085470247`*^9, 3.8340314198391542`*^9}}],
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"PalindromeQ", "[",
RowBox[{"IntegerDigits", "[",
RowBox[{"585", ",", "2"}], "]"}], "]"}]], "Code",
CellChangeTimes->{{3.834030525368428*^9, 3.8340305406309547`*^9},
3.8340311420842*^9, 3.8340313972718973`*^9, {3.8340314732904987`*^9,
3.834031632444412*^9}, {3.8340318009362597`*^9, 3.8340318259147577`*^9}, {
3.834031910718237*^9, 3.8340319123253975`*^9}}],
Cell[BoxData["True"], "Output",
CellChangeTimes->{
3.8340305433142223`*^9, 3.8340314896051297`*^9, {3.8340315264078093`*^9,
3.834031547921961*^9}, {3.8340315797101393`*^9, 3.834031640864254*^9}, {
3.8340318064038067`*^9, 3.8340318268688526`*^9}}]
}, Open ]],
Cell[CellGroupData[{
Cell[BoxData[{
RowBox[{
RowBox[{
RowBox[{"PalindromicQ", "[", "n_", "]"}], ":=",
RowBox[{"Module", "[",
RowBox[{
RowBox[{"{", "}"}], ",", "\n", "\t",
RowBox[{"If", "[",
RowBox[{
RowBox[{
RowBox[{"PalindromeQ", "[",
RowBox[{"IntegerDigits", "[",
RowBox[{"n", ",", "2"}], "]"}], "]"}], " ", "&&", " ",
RowBox[{"PalindromeQ", "[", "n", "]"}]}], ",", "n", ",", "0"}],
"]"}]}], "\n", "]"}]}], ";"}], "\n",
RowBox[{
RowBox[{"PalindromicQ", "/@",
RowBox[{"Range", "[", "1000000", "]"}]}], "//", "Total"}]}], "Code",
CellChangeTimes->{{3.8258008038272123`*^9, 3.8258008082036495`*^9},
3.82599530340702*^9, 3.82599537860802*^9, {3.826926436526827*^9,
3.826926621795352*^9}, {3.8269266541365857`*^9, 3.8269266892090926`*^9}, {
3.8269268145986304`*^9, 3.8269270607342415`*^9}, {3.826928299701293*^9,
3.8269283428202934`*^9}, 3.826928506205293*^9, {3.8269286833582935`*^9,
3.8269286845422935`*^9}, {3.8269287505802183`*^9, 3.826928837364896*^9}, {
3.826928878735033*^9, 3.8269289242895875`*^9}, {3.826929187917948*^9,
3.8269291900451603`*^9}, {3.8269335712342405`*^9, 3.826933579920109*^9}, {
3.8269342002451353`*^9, 3.8269342948795977`*^9}, {3.826934453994508*^9,
3.826934484802588*^9}, {3.8269345278018875`*^9, 3.8269346025363607`*^9}, {
3.8269349797030735`*^9, 3.8269350310402064`*^9}, {3.8269351190500064`*^9,
3.826935152429344*^9}, {3.82693522929703*^9, 3.8269352573768377`*^9}, {
3.8269353290802565`*^9, 3.8269353642912564`*^9}, {3.8269358955142565`*^9,
3.826935922493352*^9}, {3.8269362234794474`*^9, 3.82693623760286*^9}, {
3.826936542273324*^9, 3.826936603461442*^9}, 3.826936663876483*^9,
3.8269371195460453`*^9, 3.826937420671155*^9, {3.826937498571944*^9,
3.826937542254312*^9}, {3.826937624536539*^9, 3.82693762894298*^9}, {
3.8269376778298683`*^9, 3.82693770204729*^9}, {3.826937807974881*^9,
3.8269378122343073`*^9}, {3.826937932014284*^9, 3.826937949174*^9},
3.828667679436161*^9, {3.8306382195848484`*^9, 3.8306382361707973`*^9},
3.8306384372943006`*^9, 3.8306384886302366`*^9, {3.8306385667287035`*^9,
3.8306385909880915`*^9}, {3.83063862313293*^9, 3.8306386625651855`*^9}, {
3.830644055201845*^9, 3.83064410805513*^9}, {3.830644184871811*^9,
3.830644302581581*^9}, {3.8308251560308704`*^9, 3.8308252044017067`*^9}, {
3.8308260348417425`*^9, 3.830826038355094*^9}, {3.830828602335476*^9,
3.8308286086701093`*^9}, {3.830829523439577*^9, 3.830829529125146*^9}, {
3.8308297186860995`*^9, 3.83082971888612*^9}, 3.8308326388450956`*^9, {
3.8308327440536156`*^9, 3.830832765280738*^9}, {3.833512172233643*^9,
3.833512202019621*^9}, 3.8339438593076167`*^9, {3.834027324360879*^9,
3.834027394623904*^9}, {3.834027433455787*^9, 3.8340274991853595`*^9},
3.8340281572836123`*^9, {3.8340283154184246`*^9, 3.834028324589341*^9}, {
3.834028402031087*^9, 3.8340284089907827`*^9}, {3.834028482799165*^9,
3.834028523415226*^9}, {3.8340285877516594`*^9, 3.8340286361434975`*^9}, {
3.834028741665062*^9, 3.8340287476056557`*^9}, {3.834028794551715*^9,
3.834028864792715*^9}, {3.8340289154607153`*^9, 3.8340289314377155`*^9},
3.834028966372715*^9, {3.8340290823887153`*^9, 3.8340291719917154`*^9}, {
3.83402948182408*^9, 3.8340295456304617`*^9}, {3.8340296727951775`*^9,
3.834029681248022*^9}, {3.8340298187107677`*^9, 3.8340298444723434`*^9}, {
3.834030395162409*^9, 3.8340305199258842`*^9}, 3.834030566124503*^9, {
3.8340305987997704`*^9, 3.8340307476976585`*^9}, {3.8340307838152704`*^9,
3.8340308858565655`*^9}, {3.8340309252875137`*^9, 3.834030955574542*^9}, {
3.834031043653349*^9, 3.8340310599799814`*^9}, 3.8340311438503766`*^9, {
3.8340316537815456`*^9, 3.834031727450912*^9}, {3.834031761464313*^9,
3.8340317851096773`*^9}, {3.834031849597125*^9, 3.8340318968228474`*^9}}],
Cell[BoxData["872187"], "Output",
CellChangeTimes->{
3.8340295713850374`*^9, {3.8340304074196343`*^9, 3.8340305140012913`*^9}, {
3.8340306364025307`*^9, 3.8340307482117105`*^9}, {3.834030839424923*^9,
3.834030847091689*^9}, {3.8340308814501247`*^9, 3.834030942193204*^9}, {
3.834031050239007*^9, 3.834031077399723*^9}, {3.83403171382755*^9,
3.834031717258893*^9}, 3.834031902458411*^9}]
}, Open ]]
}, Open ]],
Cell[CellGroupData[{
Cell["\[FilledSquare]37. Truncatable primes", "Subsubsection",
CellChangeTimes->{
3.82580077140097*^9, {3.825995270185877*^9, 3.8259952717480335`*^9},
3.82599530340602*^9, {3.828667656163834*^9, 3.8286676703462524`*^9}, {
3.833512172233643*^9, 3.833512202019621*^9}, {3.8335122468091*^9,
3.8335122480292215`*^9}, {3.8339372134308176`*^9,
3.8339372147599506`*^9}, {3.8340283754644303`*^9,
3.8340283863845224`*^9}, {3.8340295943683357`*^9,
3.8340296064345417`*^9}, {3.8340311250985017`*^9,
3.8340311271757092`*^9}, {3.8340319466488314`*^9, 3.834031948280995*^9}}],
Cell["\<\
The number 3797 has an interesting property. Being prime itself, it is \
possible to continuously remove digits from left to right, and remain prime \
at each stage: 3797, 797, 97, and 7. Similarly we can work from right to \
left: 3797, 379, 37, and 3.
Find the sum of the only eleven primes that are both truncatable from left to \
right and right to left.
NOTE: 2, 3, 5, and 7 are not considered to be truncatable primes.\
\>", "Text",
CellChangeTimes->{
3.825800785096339*^9, {3.8259952767425327`*^9, 3.82599530340602*^9}, {
3.8286676751977377`*^9, 3.8286676949327106`*^9}, {3.833512172233643*^9,
3.833512202019621*^9}, {3.8339372205695314`*^9, 3.833937233008775*^9}, {
3.8340283843173156`*^9, 3.8340283941883025`*^9}, {3.8340296108909874`*^9,
3.834029615935492*^9}, {3.834031133095301*^9, 3.834031137651757*^9}, {
3.8340314085470247`*^9, 3.8340314198391542`*^9}, {3.8340319533535023`*^9,
3.834031957160883*^9}}],
Cell[CellGroupData[{
Cell[BoxData[{
RowBox[{"IntegerDigits", "[", "3797", "]"}], "\n",
RowBox[{
RowBox[{"IntegerDigits", "[", "3797", "]"}], "\[LeftDoubleBracket]",
RowBox[{"2", ";;", "4"}], "\[RightDoubleBracket]"}], "\n",
RowBox[{
RowBox[{"IntegerDigits", "[", "3797", "]"}], "\[LeftDoubleBracket]",
RowBox[{"3", ";;", "4"}], "\[RightDoubleBracket]"}], "\n",
RowBox[{
RowBox[{"IntegerDigits", "[", "3797", "]"}], "\[LeftDoubleBracket]",
RowBox[{"4", ";;", "4"}], "\[RightDoubleBracket]"}], "\n",
RowBox[{
RowBox[{"IntegerDigits", "[", "3797", "]"}], "\[LeftDoubleBracket]",
RowBox[{"1", ";;", "1"}], "\[RightDoubleBracket]"}], "\n",
RowBox[{
RowBox[{"IntegerDigits", "[", "3797", "]"}], "\[LeftDoubleBracket]",
RowBox[{"1", ";;", "2"}], "\[RightDoubleBracket]"}], "\n",
RowBox[{
RowBox[{"IntegerDigits", "[", "3797", "]"}], "\[LeftDoubleBracket]",
RowBox[{"1", ";;", "3"}], "\[RightDoubleBracket]"}]}], "Code",
CellChangeTimes->{{3.834030525368428*^9, 3.8340305406309547`*^9},
3.8340311420842*^9, 3.8340313972718973`*^9, {3.8340314732904987`*^9,
3.834031632444412*^9}, {3.8340318009362597`*^9, 3.8340318259147577`*^9}, {
3.834031910718237*^9, 3.8340319123253975`*^9}, {3.834032058104976*^9,
3.8340320600261683`*^9}, {3.8340360828812094`*^9, 3.834036180509209*^9}, {
3.834036375450209*^9, 3.8340363821692095`*^9}, {3.834036615686351*^9,
3.834036644222204*^9}, {3.834036677617543*^9, 3.8340366858553667`*^9}, {
3.8340367171754985`*^9, 3.834036853696149*^9}, {3.834037089107688*^9,
3.8340371044512224`*^9}, {3.8340980171169715`*^9, 3.834098017415001*^9}, {
3.834099160611309*^9, 3.8340991813253803`*^9}, {3.834099279991514*^9,
3.8340992900575204`*^9}, {3.834105541711584*^9, 3.8341055738157945`*^9}, {
3.834105624324845*^9, 3.83410566228264*^9}, {3.8341081098994875`*^9,
3.8341081296304607`*^9}}],
Cell[BoxData[
RowBox[{"{",
RowBox[{"3", ",", "7", ",", "9", ",", "7"}], "}"}]], "Output",
CellChangeTimes->{{3.8340367546882496`*^9, 3.8340367731420946`*^9}, {
3.8340368035521355`*^9, 3.834036854997279*^9}, 3.8340371053843155`*^9,
3.8340991819034386`*^9, {3.8341055480022135`*^9, 3.834105574216834*^9}, {
3.8341056263640485`*^9, 3.834105662931705*^9}}],
Cell[BoxData[
RowBox[{"{",
RowBox[{"7", ",", "9", ",", "7"}], "}"}]], "Output",
CellChangeTimes->{{3.8340367546882496`*^9, 3.8340367731420946`*^9}, {
3.8340368035521355`*^9, 3.834036854997279*^9}, 3.8340371053843155`*^9,
3.8340991819034386`*^9, {3.8341055480022135`*^9, 3.834105574216834*^9}, {
3.8341056263640485`*^9, 3.8341056629347053`*^9}}],
Cell[BoxData[
RowBox[{"{",
RowBox[{"9", ",", "7"}], "}"}]], "Output",
CellChangeTimes->{{3.8340367546882496`*^9, 3.8340367731420946`*^9}, {
3.8340368035521355`*^9, 3.834036854997279*^9}, 3.8340371053843155`*^9,
3.8340991819034386`*^9, {3.8341055480022135`*^9, 3.834105574216834*^9}, {
3.8341056263640485`*^9, 3.8341056629367056`*^9}}],
Cell[BoxData[
RowBox[{"{", "7", "}"}]], "Output",
CellChangeTimes->{{3.8340367546882496`*^9, 3.8340367731420946`*^9}, {
3.8340368035521355`*^9, 3.834036854997279*^9}, 3.8340371053843155`*^9,
3.8340991819034386`*^9, {3.8341055480022135`*^9, 3.834105574216834*^9}, {
3.8341056263640485`*^9, 3.8341056629387054`*^9}}],
Cell[BoxData[
RowBox[{"{", "3", "}"}]], "Output",
CellChangeTimes->{{3.8340367546882496`*^9, 3.8340367731420946`*^9}, {
3.8340368035521355`*^9, 3.834036854997279*^9}, 3.8340371053843155`*^9,
3.8340991819034386`*^9, {3.8341055480022135`*^9, 3.834105574216834*^9}, {
3.8341056263640485`*^9, 3.8341056629407063`*^9}}],
Cell[BoxData[
RowBox[{"{",
RowBox[{"3", ",", "7"}], "}"}]], "Output",
CellChangeTimes->{{3.8340367546882496`*^9, 3.8340367731420946`*^9}, {
3.8340368035521355`*^9, 3.834036854997279*^9}, 3.8340371053843155`*^9,
3.8340991819034386`*^9, {3.8341055480022135`*^9, 3.834105574216834*^9}, {
3.8341056263640485`*^9, 3.834105662942706*^9}}],
Cell[BoxData[
RowBox[{"{",
RowBox[{"3", ",", "7", ",", "9"}], "}"}]], "Output",
CellChangeTimes->{{3.8340367546882496`*^9, 3.8340367731420946`*^9}, {
3.8340368035521355`*^9, 3.834036854997279*^9}, 3.8340371053843155`*^9,
3.8340991819034386`*^9, {3.8341055480022135`*^9, 3.834105574216834*^9}, {
3.8341056263640485`*^9, 3.8341056629447064`*^9}}],
Cell[BoxData["611953"], "Output",
CellChangeTimes->{{3.8340367546882496`*^9, 3.8340367731420946`*^9}, {
3.8340368035521355`*^9, 3.834036854997279*^9}, 3.8340371053843155`*^9,
3.8340991819034386`*^9, {3.8341055480022135`*^9, 3.834105574216834*^9}, {
3.8341056263640485`*^9, 3.8341056629467063`*^9}}]
}, Open ]],
Cell[CellGroupData[{
Cell[BoxData[{
RowBox[{
RowBox[{
RowBox[{"TruncatedPrimeQ", "[", "n_", "]"}], ":=",
RowBox[{"Module", "[",
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{"length", "=",
RowBox[{
RowBox[{"IntegerDigits", "[", "n", "]"}], "//", "Length"}]}], ",",
RowBox[{"digits", "=",
RowBox[{"IntegerDigits", "[", "n", "]"}]}]}], "}"}], ",", "\n", "\t",
RowBox[{"AllTrue", "[",
RowBox[{
RowBox[{"FromDigits", "/@",
RowBox[{"Union", "[",
RowBox[{
RowBox[{"{",
RowBox[{"{", "n", "}"}], "}"}], ",",
RowBox[{"Table", "[",
RowBox[{
RowBox[{"digits", "\[LeftDoubleBracket]",
RowBox[{"1", ";;", "i"}], "\[RightDoubleBracket]"}], ",",
RowBox[{"{",
RowBox[{"i", ",", "1", ",",
RowBox[{"length", "-", "1"}]}], "}"}]}], "]"}], ",",
RowBox[{"Table", "[",
RowBox[{
RowBox[{"digits", "\[LeftDoubleBracket]",
RowBox[{"j", ";;", "length"}], "\[RightDoubleBracket]"}], ",",
RowBox[{"{",
RowBox[{"j", ",", "2", ",", "length"}], "}"}]}], "]"}]}],
"]"}]}], ",", "PrimeQ"}], "]"}]}], "\n", "]"}]}], ";"}], "\n",
RowBox[{"Select", "[",
RowBox[{
RowBox[{"Range", "[", "1000000", "]"}], ",",
RowBox[{
RowBox[{
RowBox[{"TruncatedPrimeQ", "[", "#", "]"}], "&&",
RowBox[{"!",
RowBox[{"MemberQ", "[",
RowBox[{
RowBox[{"{",
RowBox[{"2", ",", "3", ",", "5", ",", "7"}], "}"}], ",", "#"}],
"]"}]}]}], "&"}]}], "]"}]}], "Code",
CellChangeTimes->{{3.8341081489023876`*^9, 3.8341084114686413`*^9}, {
3.8341084908985834`*^9, 3.8341085431648097`*^9}, {3.8341085776942625`*^9,
3.834108637244217*^9}, {3.8341087254550476`*^9, 3.834108777302232*^9}, {
3.834109073103809*^9, 3.8341092016456614`*^9}, {3.8341092361391106`*^9,
3.834109287595256*^9}}],
Cell[BoxData[
RowBox[{"{",
RowBox[{
"23", ",", "37", ",", "53", ",", "73", ",", "313", ",", "317", ",", "373",
",", "797", ",", "3137", ",", "3797", ",", "739397"}], "}"}]], "Output",
CellChangeTimes->{{3.8341083398694825`*^9, 3.8341083513356285`*^9},
3.834108412386733*^9, 3.8341084914586396`*^9, {3.834108525935087*^9,
3.8341085436118546`*^9}, {3.8341085848909817`*^9, 3.834108637867279*^9},
3.8341087407665787`*^9, 3.8341090990744057`*^9, {3.834109257455242*^9,
3.834109278048301*^9}, 3.834109326732169*^9}]
}, Open ]],
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"Total", "@", "%"}]], "Code",
CellChangeTimes->{{3.834109550564555*^9, 3.834109554848984*^9}}],
Cell[BoxData["748317"], "Output",
CellChangeTimes->{3.8341095579192905`*^9}]
}, Open ]]
}, Open ]],
Cell[CellGroupData[{
Cell["\[FilledSquare]38. Pandigital multiples", "Subsubsection",
CellChangeTimes->{
3.82580077140097*^9, {3.825995270185877*^9, 3.8259952717480335`*^9},
3.82599530340602*^9, {3.828667656163834*^9, 3.8286676703462524`*^9}, {
3.833512172233643*^9, 3.833512202019621*^9}, {3.8335122468091*^9,
3.8335122480292215`*^9}, {3.8339372134308176`*^9,
3.8339372147599506`*^9}, {3.8340283754644303`*^9,
3.8340283863845224`*^9}, {3.8341096400114994`*^9, 3.8341096417556734`*^9}}],
Cell["\<\
Take the number 192 and multiply it by each of 1, 2, and 3:
192 \[Times] 1 = 192
192 \[Times] 2 = 384
192 \[Times] 3 = 576
By concatenating each product we get the 1 to 9 pandigital, 192384576. We \
will call 192384576 the concatenated product of 192 and (1,2,3)
The same can be achieved by starting with 9 and multiplying by 1, 2, 3, 4, \
and 5, giving the pandigital, 918273645, which is the concatenated product of \
9 and (1,2,3,4,5).
What is the largest 1 to 9 pandigital 9-digit number that can be formed as \
the concatenated product of an integer with (1,2, ... , n) where n > 1?\
\>", "Text",
CellChangeTimes->{
3.825800785096339*^9, {3.8259952767425327`*^9, 3.82599530340602*^9}, {
3.8286676751977377`*^9, 3.8286676949327106`*^9}, {3.833512172233643*^9,
3.833512202019621*^9}, {3.8339372205695314`*^9, 3.833937233008775*^9}, {
3.8340283843173156`*^9, 3.8340283941883025`*^9}, {3.834109647297228*^9,
3.8341096563441324`*^9}}],
Cell[BoxData["skip"], "Code",
CellChangeTimes->{{3.834028967836715*^9, 3.834029000678715*^9},
3.8341096599754953`*^9, {3.8342957360964203`*^9, 3.8342958573495445`*^9}, {
3.8345263123582444`*^9, 3.8345263128822966`*^9}}]
}, Open ]],
Cell[CellGroupData[{
Cell["\[FilledSquare]39. Integer right triangles", "Subsubsection",
CellChangeTimes->{
3.82580077140097*^9, {3.825995270185877*^9, 3.8259952717480335`*^9},
3.82599530340602*^9, {3.828667656163834*^9, 3.8286676703462524`*^9}, {
3.833512172233643*^9, 3.833512202019621*^9}, {3.8335122468091*^9,
3.8335122480292215`*^9}, {3.8339372134308176`*^9,
3.8339372147599506`*^9}, {3.8340283754644303`*^9,
3.8340283863845224`*^9}, {3.8341096400114994`*^9,
3.8341096417556734`*^9}, {3.834526652706276*^9, 3.834526654656471*^9}}],
Cell["\<\
If p is the perimeter of a right angle triangle with integral length sides, \
{a,b,c}, there are exactly three solutions for p = 120.
{20,48,52}, {24,45,51}, {30,40,50}
For which value of p \[LessEqual] 1000, is the number of solutions maximized?\
\>", "Text",
CellChangeTimes->{
3.825800785096339*^9, {3.8259952767425327`*^9, 3.82599530340602*^9}, {
3.8286676751977377`*^9, 3.8286676949327106`*^9}, {3.833512172233643*^9,
3.833512202019621*^9}, {3.8339372205695314`*^9, 3.833937233008775*^9}, {
3.8340283843173156`*^9, 3.8340283941883025`*^9}, {3.834109647297228*^9,
3.8341096563441324`*^9}, {3.83452666264927*^9, 3.834526699830988*^9}}],
Cell[CellGroupData[{
Cell[BoxData[{
RowBox[{
RowBox[{
RowBox[{"Solutions", "[", "n_", "]"}], ":=",
RowBox[{"Module", "[",
RowBox[{
RowBox[{"{", "solutions", "}"}], ",", "\n", "\t",
RowBox[{
RowBox[{"solutions", " ", "=", " ",
RowBox[{
RowBox[{"Solve", "[",
RowBox[{
RowBox[{
RowBox[{
RowBox[{
RowBox[{"x", "^", "2"}], "+",
RowBox[{"y", "^", "2"}]}], "==",
RowBox[{"z", "^", "2"}]}], " ", "&&", " ",
RowBox[{
RowBox[{"x", "+", "y", "+", "z"}], "\[Equal]", "n"}], " ", "&&",
" ",
RowBox[{
RowBox[{"x", "+", "y"}], ">", "z"}], " ", "&&", " ",
RowBox[{
RowBox[{"x", "+", "z"}], ">", "y"}], " ", "&&", " ",
RowBox[{
RowBox[{"z", "+", "y"}], ">", "x"}]}], ",",
RowBox[{"{",
RowBox[{"x", ",", "y", ",", "z"}], "}"}], ",", "Integers"}], "]"}],
"//",
RowBox[{
RowBox[{"DeleteCases", "[",
RowBox[{"#", ",",
RowBox[{"{", "}"}]}], "]"}], "&"}]}]}], ";", "\n", "\t",
RowBox[{"If", "[",
RowBox[{
RowBox[{"solutions", "\[NotEqual]", " ",
RowBox[{"{", "}"}]}], ",",
RowBox[{
RowBox[{
RowBox[{"Sort", "/@",
RowBox[{"(",
RowBox[{
RowBox[{"{",
RowBox[{"x", ",", "y", ",", "z"}], "}"}], "/.", "solutions"}],
")"}]}], "//", "DeleteDuplicates"}], "//", "Length"}], ",", "0"}],
"]"}]}]}], "\n", "]"}]}], ";"}], "\n",
RowBox[{"Solutions", "/@",
RowBox[{"Range", "[", "1000", "]"}]}]}], "Code",
CellChangeTimes->{{3.834028967836715*^9, 3.834029000678715*^9},
3.8341096599754953`*^9, {3.8342957360964203`*^9, 3.8342958573495445`*^9}, {
3.8345263123582444`*^9, 3.8345263128822966`*^9}, {3.834527560930089*^9,
3.8345276346864643`*^9}, {3.83452776936193*^9, 3.834527812077201*^9}, {
3.8345450321896844`*^9, 3.834545035427008*^9}, 3.8345450780062656`*^9, {
3.8345451764171057`*^9, 3.834545212974761*^9}, {3.8345453265711193`*^9,
3.8345456163170915`*^9}, {3.8345456818186407`*^9, 3.834545699792438*^9}, {
3.834545832796737*^9, 3.834545851658623*^9}, {3.8345459659760537`*^9,
3.8345459680472608`*^9}, {3.8345536113795366`*^9, 3.834553640247423*^9}, {
3.834553694873885*^9, 3.8345537843498316`*^9}, {3.8345542963730288`*^9,
3.8345543308794794`*^9}, {3.83455441569396*^9, 3.8345545808564744`*^9}, {
3.834554652956684*^9, 3.8345547815465417`*^9}}],
Cell[BoxData[
RowBox[{"{",
RowBox[{
"0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0",
",", "0", ",", "0", ",", "0", ",", "1", ",", "0", ",", "0", ",", "0", ",",
"0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0",
",", "1", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "1", ",",
"0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "1", ",", "0", ",", "0",
",", "0", ",", "1", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",",
"0", ",", "0", ",", "1", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0",
",", "0", ",", "0", ",", "1", ",", "0", ",", "0", ",", "0", ",", "2", ",",
"0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0",
",", "0", ",", "1", ",", "0", ",", "1", ",", "0", ",", "0", ",", "0", ",",
"0", ",", "0", ",", "0", ",", "0", ",", "1", ",", "0", ",", "0", ",", "0",
",", "2", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "2", ",",
"0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "1", ",", "0", ",", "0",
",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",",
"0", ",", "0", ",", "1", ",", "0", ",", "0", ",", "0", ",", "1", ",", "0",
",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "3", ",",
"0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "1", ",", "0", ",", "0",
",", "0", ",", "0", ",", "0", ",", "2", ",", "0", ",", "0", ",", "0", ",",
"0", ",", "0", ",", "0", ",", "0", ",", "1", ",", "0", ",", "0", ",", "0",
",", "2", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "1", ",",
"0", ",", "0", ",", "0", ",", "1", ",", "0", ",", "1", ",", "0", ",", "0",
",", "0", ",", "1", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",",
"0", ",", "0", ",", "3", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0",
",", "0", ",", "0", ",", "1", ",", "0", ",", "0", ",", "0", ",", "3", ",",
"0", ",", "1", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0",
",", "0", ",", "0", ",", "0", ",", "1", ",", "0", ",", "0", ",", "0", ",",
"0", ",", "0", ",", "1", ",", "0", ",", "1", ",", "0", ",", "0", ",", "0",
",", "1", ",", "0", ",", "0", ",", "0", ",", "1", ",", "0", ",", "2", ",",
"0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "1", ",", "0", ",", "0",
",", "0", ",", "1", ",", "0", ",", "0", ",", "0", ",", "1", ",", "0", ",",
"0", ",", "0", ",", "1", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0",
",", "1", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "4", ",",
"0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0",
",", "0", ",", "0", ",", "0", ",", "3", ",", "0", ",", "0", ",", "0", ",",
"0", ",", "0", ",", "0", ",", "0", ",", "1", ",", "0", ",", "0", ",", "0",
",", "2", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "2", ",",
"0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "1", ",", "0", ",", "0",
",", "0", ",", "3", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",",
"1", ",", "0", ",", "2", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0",
",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "2", ",",
"0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "1", ",", "0", ",", "1",
",", "0", ",", "0", ",", "0", ",", "2", ",", "0", ",", "0", ",", "0", ",",
"0", ",", "0", ",", "0", ",", "0", ",", "1", ",", "0", ",", "0", ",", "0",
",", "1", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "2", ",",
"0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "3", ",", "0", ",", "0",
",", "0", ",", "1", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",",
"0", ",", "0", ",", "1", ",", "0", ",", "1", ",", "0", ",", "1", ",", "0",
",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "4", ",",
"0", ",", "0", ",", "0", ",", "1", ",", "0", ",", "0", ",", "0", ",", "0",
",", "0", ",", "0", ",", "0", ",", "1", ",", "0", ",", "1", ",", "0", ",",
"0", ",", "0", ",", "1", ",", "0", ",", "1", ",", "0", ",", "0", ",", "0",
",", "1", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "2", ",",
"0", ",", "1", ",", "0", ",", "0", ",", "0", ",", "3", ",", "0", ",", "0",
",", "0", ",", "1", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",",
"0", ",", "0", ",", "2", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0",
",", "0", ",", "0", ",", "1", ",", "0", ",", "1", ",", "0", ",", "5", ",",
"0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0",
",", "0", ",", "0", ",", "0", ",", "2", ",", "0", ",", "0", ",", "0", ",",
"0", ",", "0", ",", "0", ",", "0", ",", "2", ",", "0", ",", "1", ",", "0",
",", "1", ",", "0", ",", "0", ",", "0", ",", "1", ",", "0", ",", "2", ",",
"0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "2", ",", "0", ",", "0",
",", "0", ",", "0", ",", "0", ",", "2", ",", "0", ",", "0", ",", "0", ",",
"0", ",", "0", ",", "2", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0",
",", "0", ",", "0", ",", "1", ",", "0", ",", "0", ",", "0", ",", "4", ",",
"0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0",
",", "0", ",", "1", ",", "0", ",", "1", ",", "0", ",", "1", ",", "0", ",",
"0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0",
",", "4", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "2", ",",
"0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "1", ",", "0", ",", "0",
",", "0", ",", "2", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",",
"0", ",", "0", ",", "3", ",", "0", ",", "0", ",", "0", ",", "1", ",", "0",
",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "3", ",",
"0", ",", "0", ",", "0", ",", "1", ",", "0", ",", "2", ",", "0", ",", "0",
",", "0", ",", "0", ",", "0", ",", "2", ",", "0", ",", "0", ",", "0", ",",
"0", ",", "0", ",", "0", ",", "0", ",", "3", ",", "0", ",", "0", ",", "0",
",", "1", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "2", ",",
"0", ",", "1", ",", "0", ",", "0", ",", "0", ",", "2", ",", "0", ",", "0",
",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",",
"0", ",", "0", ",", "2", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0",
",", "1", ",", "0", ",", "0", ",", "0", ",", "1", ",", "0", ",", "3", ",",
"0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "1",
",", "0", ",", "0", ",", "0", ",", "2", ",", "0", ",", "0", ",", "0", ",",
"2", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0",
",", "3", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "4", ",",
"0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "1", ",", "0", ",", "0",
",", "0", ",", "1", ",", "0", ",", "0", ",", "0", ",", "1", ",", "0", ",",
"1", ",", "0", ",", "1", ",", "0", ",", "1", ",", "0", ",", "0", ",", "0",
",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "5", ",",
"0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0",
",", "0", ",", "0", ",", "0", ",", "4", ",", "0", ",", "0", ",", "0", ",",
"0", ",", "0", ",", "0", ",", "0", ",", "2", ",", "0", ",", "0", ",", "0",
",", "2", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "2", ",",
"0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "1", ",", "0", ",", "0",
",", "0", ",", "2", ",", "0", ",", "1", ",", "0", ",", "1", ",", "0", ",",
"0", ",", "0", ",", "1", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0",
",", "1", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "6", ",",
"0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "2",
",", "0", ",", "0", ",", "0", ",", "1", ",", "0", ",", "0", ",", "0", ",",
"1", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0",
",", "1", ",", "0", ",", "0", ",", "0", ",", "1", ",", "0", ",", "1", ",",
"0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "4", ",", "0", ",", "0",
",", "0", ",", "2", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",",
"0", ",", "0", ",", "1", ",", "0", ",", "2", ",", "0", ",", "0", ",", "0",
",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "4", ",",
"0", ",", "1", ",", "0", ",", "1", ",", "0", ",", "0", ",", "0", ",", "0",
",", "0", ",", "0", ",", "0", ",", "3", ",", "0", ",", "0", ",", "0", ",",
"0", ",", "0", ",", "1", ",", "0", ",", "2", ",", "0", ",", "0", ",", "0",
",", "1", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "2", ",",
"0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "2", ",", "0", ",", "0",
",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",",
"0", ",", "0", ",", "2", ",", "0", ",", "0", ",", "0", ",", "1", ",", "0",
",", "0", ",", "0", ",", "1", ",", "0", ",", "0", ",", "0", ",", "8", ",",
"0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0",
",", "0", ",", "1", ",", "0", ",", "1", ",", "0", ",", "0", ",", "0", ",",
"0", ",", "0", ",", "1", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0",
",", "3", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "2", ",",
"0", ",", "0", ",", "0", ",", "1", ",", "0", ",", "1", ",", "0", ",", "0",
",", "0", ",", "3", ",", "0", ",", "1", ",", "0", ",", "1", ",", "0", ",",
"0", ",", "0", ",", "1", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0",
",", "0", ",", "0", ",", "1", ",", "0", ",", "0", ",", "0", ",", "4", ",",
"0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0",
",", "0", ",", "2", ",", "0", ",", "2", ",", "0", ",", "0", ",", "0", ",",
"0", ",", "0", ",", "2", ",", "0", ",", "2", ",", "0", ",", "0", ",", "0",
",", "5", ",", "0", ",", "0", ",", "0", ",", "1", ",", "0", ",", "1", ",",
"0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "3", ",", "0", ",", "0",
",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",",
"0", ",", "0", ",", "1", ",", "0", ",", "1", ",", "0", ",", "2", ",", "0",
",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "4", ",",
"0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "1", ",", "0", ",", "0",
",", "0", ",", "0", ",", "0", ",", "1", ",", "0", ",", "0", ",", "0", ",",
"0", ",", "0", ",", "0", ",", "0", ",", "1", ",", "0", ",", "0", ",", "0",
",", "1", ",", "0", ",", "1", ",", "0", ",", "1", ",", "0", ",", "4", ",",
"0", ",", "1", ",", "0", ",", "0", ",", "0", ",", "1", ",", "0", ",", "0",
",", "0", ",", "1"}], "}"}]], "Output",
CellChangeTimes->{{3.834554725436931*^9, 3.8345547321646037`*^9},
3.8345547703734245`*^9, 3.834554807082095*^9}]
}, Open ]],
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"Position", "[",
RowBox[{
RowBox[{"Out", "[", "346", "]"}], ",",
RowBox[{
RowBox[{"Out", "[", "346", "]"}], "//", "Max"}]}], "]"}]], "Code",
CellChangeTimes->{{3.8345548267110577`*^9, 3.8345548297813644`*^9}, {
3.8345548715135374`*^9, 3.8345549619075756`*^9}, {3.8345549965280375`*^9,
3.8345550133197165`*^9}}],
Cell[BoxData[
RowBox[{"{",
RowBox[{"{", "840", "}"}], "}"}]], "Output",
CellChangeTimes->{
3.834554830143401*^9, {3.8345548851949053`*^9, 3.83455495154654*^9},
3.834555013685753*^9}]
}, Open ]]
}, Open ]],
Cell[CellGroupData[{
Cell["\[FilledSquare]40. Champernowne\[CloseCurlyQuote]s constant", \
"Subsubsection",
CellChangeTimes->{
3.82580077140097*^9, {3.825995270185877*^9, 3.8259952717480335`*^9},
3.82599530340602*^9, {3.828667656163834*^9, 3.8286676703462524`*^9}, {
3.833512172233643*^9, 3.833512202019621*^9}, {3.8335122468091*^9,
3.8335122480292215`*^9}, {3.8339372134308176`*^9,
3.8339372147599506`*^9}, {3.8340283754644303`*^9,
3.8340283863845224`*^9}, {3.8341096400114994`*^9,
3.8341096417556734`*^9}, {3.8345550671110954`*^9, 3.8345550774711313`*^9}}],
Cell[TextData[{
"An irrational decimal fraction is created by concatenating the positive \
integers:\n0.12345678910",
StyleBox["1",
FontColor->RGBColor[1, 0, 0]],
"112131415161718192021...\nIt can be seen that the ",
Cell[BoxData[
FormBox[
SuperscriptBox["12", "th"], TraditionalForm]]],
" digit of the fractional part is 1.\nIf ",
Cell[BoxData[
FormBox[
SubscriptBox["d", "n"], TraditionalForm]]],
" represents the ",
Cell[BoxData[
FormBox[
SuperscriptBox["n", "th"], TraditionalForm]]],
" digit of the fractional part, find the value of the following expression.\n\
",
Cell[BoxData[
FormBox[
SubscriptBox["d", "1"], TraditionalForm]]],
" \[Times] ",
Cell[BoxData[
FormBox[
SubscriptBox["d", "10"], TraditionalForm]]],
" \[Times] ",
Cell[BoxData[
FormBox[
SubscriptBox["d", "100"], TraditionalForm]]],
" \[Times] ",
Cell[BoxData[
FormBox[
SubscriptBox["d", "1000"], TraditionalForm]]],
" \[Times] ... \[Times] ",
Cell[BoxData[
FormBox[
SubscriptBox["d", "1000000"], TraditionalForm]]]
}], "Text",
CellChangeTimes->{
3.825800785096339*^9, {3.8259952767425327`*^9, 3.82599530340602*^9}, {
3.8286676751977377`*^9, 3.8286676949327106`*^9}, {3.833512172233643*^9,
3.833512202019621*^9}, {3.8339372205695314`*^9, 3.833937233008775*^9}, {
3.8340283843173156`*^9, 3.8340283941883025`*^9}, {3.834109647297228*^9,
3.8341096563441324`*^9}, {3.8345550824396276`*^9,
3.8345550880941935`*^9}, {3.8345551683232155`*^9, 3.834555311025484*^9}}],
Cell[CellGroupData[{
Cell[BoxData[{
RowBox[{
RowBox[{"data", " ", "=", " ",
RowBox[{
RowBox[{"IntegerDigits", "/@",
RowBox[{"Range", "[", "185185", "]"}]}], "//", "Flatten"}]}],
";"}], "\n",
RowBox[{
RowBox[{"data", "\[LeftDoubleBracket]", "1", "\[RightDoubleBracket]"}], "*",
RowBox[{"data", "\[LeftDoubleBracket]", "10", "\[RightDoubleBracket]"}],
"*",
RowBox[{"data", "\[LeftDoubleBracket]", "100", "\[RightDoubleBracket]"}],
"*",
RowBox[{"data", "\[LeftDoubleBracket]", "1000", "\[RightDoubleBracket]"}],
"*",
RowBox[{"data", "\[LeftDoubleBracket]", "10000", "\[RightDoubleBracket]"}],
"*",
RowBox[{"data", "\[LeftDoubleBracket]", "100000", "\[RightDoubleBracket]"}],
"*",
RowBox[{
"data", "\[LeftDoubleBracket]", "1000000",
"\[RightDoubleBracket]"}]}]}], "Code",
CellChangeTimes->{{3.834028967836715*^9, 3.834029000678715*^9},
3.8341096599754953`*^9, {3.8342957360964203`*^9, 3.8342958573495445`*^9}, {
3.8345263123582444`*^9, 3.8345263128822966`*^9}, 3.834555319624344*^9, {
3.834555994192794*^9, 3.834556016379012*^9}, {3.834556169630336*^9,
3.834556182644637*^9}, {3.8346114855773907`*^9, 3.8346114975520754`*^9}, {
3.8346134343136826`*^9, 3.834613511750683*^9}, {3.834614512529683*^9,
3.834614527545683*^9}, {3.8346145710376825`*^9, 3.834614692032683*^9}, {
3.834614733314683*^9, 3.8346147560896826`*^9}, {3.8346153349956827`*^9,
3.8346153437076826`*^9}, {3.834616280048514*^9, 3.834616291235633*^9}, {
3.8346163979613037`*^9, 3.834616417163224*^9}, {3.8346164628507924`*^9,
3.834616466249132*^9}, {3.8346168044289465`*^9, 3.834616804681972*^9}, {
3.834617057107212*^9, 3.834617057836285*^9}, 3.8346170982533264`*^9, {
3.834617161867687*^9, 3.834617278366336*^9}, {3.834617584595956*^9,
3.834617615304026*^9}, {3.8346176838858833`*^9, 3.834617729083403*^9}, {
3.8346177767131653`*^9, 3.8346177879692907`*^9}, {3.83461835691218*^9,
3.834618358354324*^9}, {3.8346291768200808`*^9, 3.8346291816345625`*^9}, {
3.8346292213285313`*^9, 3.8346292627436724`*^9}, {3.834629496510047*^9,
3.8346295077811737`*^9}, {3.8346295420506*^9, 3.8346296254969444`*^9}, {
3.834629751143508*^9, 3.8346299172291145`*^9}, {3.8346300008885975`*^9,
3.8346300122295976`*^9}}],
Cell[BoxData["210"], "Output",
CellChangeTimes->{{3.83455600475485*^9, 3.8345560169950743`*^9}, {
3.8345561745058236`*^9, 3.8345561832947025`*^9}, {3.8346114862684298`*^9,
3.834611497842092*^9}, 3.8346132431150093`*^9, {3.834613428477683*^9,
3.834613445973683*^9}, {3.834613483841683*^9, 3.8346135123726826`*^9}, {
3.834614515388683*^9, 3.834614528441683*^9}, {3.834614574694683*^9,
3.8346146109096828`*^9}, {3.8346146482916827`*^9, 3.834614692599683*^9}, {
3.834614734244683*^9, 3.834614756922683*^9}, 3.834616805431047*^9,
3.834616933432846*^9, 3.8346175979542913`*^9, 3.8346176927857733`*^9, {
3.834617781324627*^9, 3.834617788530347*^9}, 3.834618358687357*^9, {
3.834629251795578*^9, 3.834629263971795*^9}, {3.8346295003334293`*^9,
3.8346295082782235`*^9}, {3.8346295450889044`*^9, 3.834629626228017*^9}, {
3.8346297525816517`*^9, 3.8346298163080235`*^9}, 3.8346299213495264`*^9, {
3.8346300064755974`*^9, 3.8346300163835974`*^9}}]
}, Open ]]
}, Open ]]
}, Open ]]
},
WindowToolbars->"EditBar",
WindowSize->{1600, 826},
WindowMargins->{{-8, Automatic}, {Automatic, -8}},
SpellingDictionaries->{"CorrectWords"->{"Fn"}},
Magnification:>1.3 Inherited,
FrontEndVersion->"11.0 for Microsoft Windows (64-bit) (2016\:5e7410\:67088\
\:65e5)",
StyleDefinitions->"Default.nb"
]
(* End of Notebook Content *)
(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[CellGroupData[{
Cell[580, 22, 224, 4, 117, "Title"],
Cell[CellGroupData[{
Cell[829, 30, 273, 4, 43, "Subsubsection",
CellGroupingRules->{"GroupTogetherGrouping", 10000.}],
Cell[1105, 36, 667, 12, 139, "Text",
CellGroupingRules->{"GroupTogetherGrouping", 10000.}],
Cell[1775, 50, 2425, 37, 65, "Code",
CellGroupingRules->{"GroupTogetherGrouping", 10000.}],
Cell[4203, 89, 429, 6, 39, "Output",
CellGroupingRules->{"GroupTogetherGrouping", 10000.}],
Cell[4635, 97, 380, 6, 39, "Text",
CellGroupingRules->{"GroupTogetherGrouping", 10000.}],
Cell[5018, 105, 309, 7, 65, "Code",
CellGroupingRules->{"GroupTogetherGrouping", 10000.}],
Cell[5330, 114, 1056, 27, 39, "Output",
CellGroupingRules->{"GroupTogetherGrouping", 10000.}],
Cell[6389, 143, 10453, 246, 346, "Text",
CellGroupingRules->{"GroupTogetherGrouping", 10000.}],
Cell[16845, 391, 3936, 71, 234, "Code",
CellGroupingRules->{"GroupTogetherGrouping", 10000.}],
Cell[20784, 464, 222, 3, 29, "Print",
CellGroupingRules->{"GroupTogetherGrouping", 10000.}],
Cell[21009, 469, 224, 3, 29, "Print",
CellGroupingRules->{"GroupTogetherGrouping", 10000.}],
Cell[21236, 474, 224, 3, 29, "Print",
CellGroupingRules->{"GroupTogetherGrouping", 10000.}],
Cell[21463, 479, 222, 3, 29, "Print",
CellGroupingRules->{"GroupTogetherGrouping", 10000.}]
}, Open ]],
Cell[CellGroupData[{
Cell[21722, 487, 280, 4, 43, "Subsubsection"],
Cell[22005, 493, 822, 14, 114, "Text"],
Cell[CellGroupData[{
Cell[22852, 511, 615, 17, 90, "Code"],
Cell[23470, 530, 99, 1, 39, "Output"]
}, Open ]],
Cell[CellGroupData[{
Cell[23606, 536, 6554, 131, 186, "Code"],
Cell[30163, 669, 229, 3, 39, "Output"],
Cell[30395, 674, 299, 5, 39, "Output"]
}, Open ]],
Cell[CellGroupData[{
Cell[30731, 684, 127, 2, 65, "Code"],
Cell[30861, 688, 74, 1, 39, "Output"]
}, Open ]]
}, Open ]],
Cell[CellGroupData[{
Cell[30984, 695, 385, 5, 43, "Subsubsection"],
Cell[31372, 702, 810, 13, 139, "Text"],
Cell[CellGroupData[{
Cell[32207, 719, 2361, 31, 65, "Code"],
Cell[34571, 752, 95, 1, 39, "Output"]
}, Open ]]
}, Open ]],
Cell[CellGroupData[{
Cell[34715, 759, 429, 6, 43, "Subsubsection"],
Cell[35147, 767, 538, 10, 89, "Text"],
Cell[35688, 779, 204, 5, 65, "Code"],
Cell[CellGroupData[{
Cell[35917, 788, 3360, 56, 138, "Code"],
Cell[39280, 846, 76, 1, 39, "Output"]
}, Open ]]
}, Open ]],
Cell[CellGroupData[{
Cell[39405, 853, 482, 7, 43, "Subsubsection"],
Cell[39890, 862, 647, 12, 89, "Text"],
Cell[CellGroupData[{
Cell[40562, 878, 312, 8, 65, "Code"],
Cell[40877, 888, 373, 11, 39, "Output"]
}, Open ]],
Cell[CellGroupData[{
Cell[41287, 904, 3842, 62, 138, "Code"],
Cell[45132, 968, 328, 5, 39, "Output"]
}, Open ]]
}, Open ]],
Cell[CellGroupData[{
Cell[45509, 979, 544, 8, 43, "Subsubsection"],
Cell[46056, 989, 860, 16, 89, "Text"],
Cell[CellGroupData[{
Cell[46941, 1009, 399, 7, 65, "Code"],
Cell[47343, 1018, 256, 4, 39, "Output"]
}, Open ]],
Cell[CellGroupData[{
Cell[47636, 1027, 3916, 61, 138, "Code"],
Cell[51555, 1090, 403, 6, 39, "Output"]
}, Open ]]
}, Open ]],
Cell[CellGroupData[{
Cell[52007, 1102, 591, 9, 43, "Subsubsection"],
Cell[52601, 1113, 950, 16, 114, "Text"],
Cell[CellGroupData[{
Cell[53576, 1133, 1861, 32, 210, "Code"],
Cell[55440, 1167, 367, 6, 39, "Output"],
Cell[55810, 1175, 359, 6, 39, "Output"],
Cell[56172, 1183, 349, 6, 39, "Output"],
Cell[56524, 1191, 326, 5, 39, "Output"],
Cell[56853, 1198, 326, 5, 39, "Output"],
Cell[57182, 1205, 347, 6, 39, "Output"],
Cell[57532, 1213, 359, 6, 39, "Output"],
Cell[57894, 1221, 309, 4, 39, "Output"]
}, Open ]],
Cell[CellGroupData[{
Cell[58240, 1230, 1970, 50, 138, "Code"],
Cell[60213, 1282, 537, 9, 39, "Output"]
}, Open ]],
Cell[CellGroupData[{
Cell[60787, 1296, 118, 2, 65, "Code"],
Cell[60908, 1300, 77, 1, 39, "Output"]
}, Open ]]
}, Open ]],
Cell[CellGroupData[{
Cell[61034, 1307, 487, 7, 43, "Subsubsection"],
Cell[61524, 1316, 973, 18, 189, "Text"],
Cell[62500, 1336, 227, 3, 65, "Code"]
}, Open ]],
Cell[CellGroupData[{
Cell[62764, 1344, 540, 8, 43, "Subsubsection"],
Cell[63307, 1354, 665, 11, 89, "Text"],
Cell[CellGroupData[{
Cell[63997, 1369, 2582, 60, 162, "Code"],
Cell[66582, 1431, 10706, 138, 465, "Output"]
}, Open ]],
Cell[CellGroupData[{
Cell[77325, 1574, 353, 8, 65, "Code"],
Cell[77681, 1584, 193, 5, 39, "Output"]
}, Open ]]
}, Open ]],
Cell[CellGroupData[{
Cell[77923, 1595, 563, 9, 43, "Subsubsection"],
Cell[78489, 1606, 1509, 45, 143, "Text"],
Cell[CellGroupData[{
Cell[80023, 1655, 2266, 41, 90, "Code"],
Cell[82292, 1698, 977, 13, 39, "Output"]
}, Open ]]
}, Open ]]
}, Open ]]
}
]
*)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。