Divisible[n,m] yields True if n is divisible by m, and yields False if it is not. My query is what is the fastest way to determine the smallest integer that does not divide a given integer N?
For instance, the code below gives all the numbers (up to 20) that are NOT divisible by 3:
If[Divisible[#, 3], X, #] & /@ Range[20] (* {1, 2, X, 4, 5, X, 7, 8, X, 10, 11, X, 13, 14, X, 16, 17, X, 19, 20} *) What I want is the smallest integer that does NOT divide 20, which is 3 in this case. How do you find this number (other than the obvious 1 and 2) for general N?