I'm a math enthusiast and I'm looking for examples of rare divisibilities, let's look at the following one:
Table[If[Mod[n!, n^(2 n)] == 0, Print[n]], {n, 1, 1000}]
Here n=1 is the only result and I have 999 Null's.
What should I do to avoid getting large output, where thousands of results are Null's? I mean I would like Mathematica producing a result if occurs, else completely nothing. In the example above, I would like to get "1" only, without the rest of output, where are 999 Null's.
I tried this:
Table[If[Mod[n!, n^(2 n)] == 0, Print[n],{}], {n, 1, 1000}]
But it only replaces Null by {}.
Thanks in advance.
Divisible[n!, n^(2n)]
might be a little more explicit thanMod
in this case. Also, this will never be true for integers greater than1
:n!
is less thann^(2n)
, and no number can be divisible by a greater number! $\endgroup$##&[]
as the third argument ofIf
:Table[If[Mod[n!, n^(2 n)] == 0, n, ## &[]], {n, 1, 1000}]
$\endgroup$