just_a_smallfry's blog

By just_a_smallfry, history, 16 months ago, In English

This 214966378 is the code i'm getting wrong answer for.

I've added comments too..for ease. But a quick overview — For numbers <= n , i'm making a different list (since trap cannot be set after n) , then sorting it, and iterating by calculating the divisors present till index i and setting final_answer as the maximum of those. Would be happy if somebody could help. Thanks!

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
16 months ago, # |
  Vote: I like it 0 Vote: I do not like it

After the sieve, sieve[i] for all prime numbers i will be 0. So, to fix it, for all prime_numbers, sieve[i] = i.