1
$\begingroup$

I have a question. For $x,y,n \in\Bbb N$, $y$ a power of two, being given $x$ and $y$ is there a faster way to mentally calculate $ny$ where $ny ≤ x< (n+1)y-1$ other than $\lfloor x \div y \rfloor \times y$? Thanks.

  • 0
    Perhaps you want $ny \leq x$, otherwise $x = 2$ and $y = 2$ will have no solutions.2012-11-14
  • 0
    @B.D yes, thank you2012-11-14
  • 1
    All I can think of is the usual $2^{10} \approx 1,000$ and its powers can get you $n$ with less calculation (as long as it isn't too close).2012-11-14
  • 0
    @RossMillikan I figured out one thing you could do would be x-x%y, that also gives you ny2012-11-15

0 Answers 0