Data update
This commit is contained in:
parent
ed705008a8
commit
0df55f9f24
2196 changed files with 32999 additions and 3075 deletions
15
Task/Factorial-primes/Mathematica/factorial-primes.math
Normal file
15
Task/Factorial-primes/Mathematica/factorial-primes.math
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
LimitedPrint[n_] := Module[{s = IntegerString[n], len},
|
||||
len = StringLength[s];
|
||||
If[len <= 40, s, StringJoin[StringTake[s, 20], "...", StringTake[s, -20], " (", ToString[len], " digits)"]]
|
||||
]
|
||||
|
||||
ShowFactorialPrimes[N_] := Module[{f},
|
||||
Do[
|
||||
f = Factorial[i];
|
||||
If[PrimeQ[f - 1], Print[IntegerString[i, 10, 3], "! - 1 -> ", LimitedPrint[f - 1]]];
|
||||
If[PrimeQ[f + 1], Print[IntegerString[i, 10, 3], "! + 1 -> ", LimitedPrint[f + 1]]],
|
||||
{i, 1, N}
|
||||
]
|
||||
]
|
||||
|
||||
ShowFactorialPrimes[1000]
|
||||
Loading…
Add table
Add a link
Reference in a new issue