Data update
This commit is contained in:
parent
ed705008a8
commit
0df55f9f24
2196 changed files with 32999 additions and 3075 deletions
15
Task/Giuga-numbers/Mathematica/giuga-numbers.math
Normal file
15
Task/Giuga-numbers/Mathematica/giuga-numbers.math
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
IsGiuga[n_Integer] := Module[{factors},
|
||||
factors = FactorInteger[n];
|
||||
AllTrue[factors, Function[{f},
|
||||
Mod[Quotient[n, f[[1]]] - 1, f[[1]]] == 0 && f[[1]] != n]]
|
||||
]
|
||||
|
||||
GetGiuga[N_Integer] := Module[{giugaNumbers = {}, i = 4},
|
||||
While[Length[giugaNumbers] < N,
|
||||
If[IsGiuga[i], AppendTo[giugaNumbers, i]];
|
||||
i++
|
||||
];
|
||||
giugaNumbers
|
||||
]
|
||||
|
||||
Print[GetGiuga[4]]
|
||||
Loading…
Add table
Add a link
Reference in a new issue