-1
$\begingroup$

Given any number $N$ find a positive integer $k$ such that: $N + 12 k$ is a square.

And the second case when we add an additional constraint that $k$ must be as small as possible.

$\endgroup$
0

1 Answer 1

1
$\begingroup$

What’s the solution for N = 12m + 2, 3, 5, 6, 7, 8, 10, 11?

You can prove that no solution exists or find a solution in O(log N). You can find the smallest solution in O(log N log log N) or more precisely in the time it takes to multiply numbers of log N digits.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.