Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 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