Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
11
Task/Self-numbers/Mathematica/self-numbers.math
Normal file
11
Task/Self-numbers/Mathematica/self-numbers.math
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
sum[g_] := g + Total@IntegerDigits@g
|
||||
|
||||
ming[n_] := n - IntegerLength[n]*9
|
||||
|
||||
self[n_] := NoneTrue [Range[ming[n], n - 1], sum[#] == n &]
|
||||
|
||||
Module[{t = 1, x = 1},
|
||||
Reap[
|
||||
While[t <= 50,
|
||||
If[self[x], Sow[x]; t++]; x++]
|
||||
][[2, 1]]]
|
||||
Loading…
Add table
Add a link
Reference in a new issue