Ad
  • Default User Avatar

    Correction:

    I believe turbofish (or type annotation) is necessary because the type of divs needs to be known at point of divs.len() call.

    Tested with 1.50.0.

  • Custom User Avatar

    It is waste of resources to go for full 2..integer as if we know that if n divides integer then integer / n divides it as well as a / b = c <=> a / c = b. So instead of going for full range we can go up to sqrt(integer).

    Another thing is that turbofish operator in collect is completely unneeded as it can be deduced by the compilator from return type.

  • Custom User Avatar

    This is awesome! I love how you used the filter and collect functions, but you could have gotten away with limiting the size of the range to (2..(integer/2)+1).