Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
15
Task/Deceptive-numbers/Mathematica/deceptive-numbers.math
Normal file
15
Task/Deceptive-numbers/Mathematica/deceptive-numbers.math
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
ClearAll[DeceptiveNumberQ]
|
||||
DeceptiveNumberQ[n_Integer] := If[! PrimeQ[n], PowerMod[10, n - 1, 9 n] == 1]
|
||||
c = 0;
|
||||
out = Reap[Do[
|
||||
If[DeceptiveNumberQ[i],
|
||||
Sow[i];
|
||||
c++;
|
||||
If[c >= 1000, Break[]]
|
||||
]
|
||||
,
|
||||
{i, 2, \[Infinity]}
|
||||
]][[2, 1]];
|
||||
Print["The first 100:"]
|
||||
Multicolumn[Take[out, 100], Appearance -> "Horizontal"]
|
||||
Print["The 1000th is: ", out[[1000]]]
|
||||
Loading…
Add table
Add a link
Reference in a new issue