Ad
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    It seems that the issue here is that "last" is a reference, but the result of ".collect<Vec>()" is a temporary, so in the next invocation of the closure last would be referencing a Vec from a previous closure's stack-frame which would probably blow-up, and Rust is protecting you from the creating the corruption. Happy coding!

  • Custom User Avatar

    I tried to hard-code this problem to check my understanding, and my solution produced 5001 for the first test case. When I checked the math 4 * 5001 ^ 2 + 1 is indeed divisible by 13 and 5, so this seems correct. However, the first test case suggests that the cloest value to m=5000 is 5074. Am I missreading something?