depevlad's blog

By depevlad, history, 7 years ago, In English

I am trying to solve this problem:

You are given two strictly positive integers N and K, where . Find the first K, where K′ > K, such that . It's obvious that such a number must exist. It's a known fact that as K varies over the strictly positive integers, the number of distinct values takes is exactly . However, I haven't been able to find a way to jump to the next value in the sequence quickly. I'm looking for an O(1) solution, even would be too slow.

Thank you.

Full text and comments »

  • Vote: I like it
  • +10
  • Vote: I do not like it