0
$\begingroup$

I was working on a number theory problem and create a equation. I tried research on this, but tbh I don't even know what should I google for... Here's my cases.

$$n = \sqrt{N * \frac{1+\sqrt{4k^2+1}}{2}}$$ $$m = \sqrt{N * \frac{\sqrt{4k^2+1}-1}{2}}$$

Where N is a given integer, m, n are both unknown integers, k has a given range of [0, 10] and k is a real number.

My question is, What is the fastest way to find such k that create integers m and n?

Thanks in advance!

$\endgroup$
11
  • $\begingroup$ Why would you expect the answer(s) to be unique? With $N=1$, for instance, then $k=2\sqrt 3$ works as does $k=6\sqrt 2$ $\endgroup$
    – lulu
    Commented Mar 18, 2019 at 19:42
  • $\begingroup$ @lulu Ohh it doesn't have to be unique, should I change the 'n is an unknown integer' into 'unknown integers? $\endgroup$
    – PetaGlz
    Commented Mar 18, 2019 at 19:46
  • $\begingroup$ Your header refers to "unique" solutions, but maybe you meant something else? $\endgroup$
    – lulu
    Commented Mar 18, 2019 at 19:47
  • $\begingroup$ @lulu just changed that, thanks for that. $\endgroup$
    – PetaGlz
    Commented Mar 18, 2019 at 19:48
  • $\begingroup$ In any case: for a fixed $N$, I'd compute the expression with $k=\frac 89$, and compute it for $k=9$. Then, for each integer between the two values you get you can easily find a solution $k$ that gives you that integer. $\endgroup$
    – lulu
    Commented Mar 18, 2019 at 19:48

1 Answer 1

1
$\begingroup$

Given the range in $k$, you have $$1+\frac {\sqrt{337}}{18} \le \frac {1+\sqrt{1+4k^2}}2\le 1+\frac {5\sqrt{13}}2$$ The left side is a little more than $2$ and the right a little more than $10$. The range of $n$ that is available is from $\left\lceil\sqrt{\left(1+\frac {\sqrt{337}}{18}\right)N}\right\rceil$ to $\left\lfloor\sqrt{\left(1+\frac {5\sqrt{13}}2\right)N}\right\rfloor$ inclusive. Choose your $n$ and solve the equation for $k$.

For your new problem with $m,n$, note that the radicands differ by $N$, so we can write $n^2-m^2=N=(n+m)(n-m)$. The two factors $n+m$ and $n-m$ have the same parity, so if $N$ is divisible by $2$ and not $4$ there is no solution. Otherwise, each way of factoring $N$ into two factors of the same parity give a solution to $n=\sqrt {aN+\frac N2}, m=\sqrt{aN-\frac N2}$. For each factorization, you can see if $a$ is in the range at the top of my post. If it is, $k$ will be in range, otherwise not.

$\endgroup$
7
  • $\begingroup$ Thanks for your quick answer! $\endgroup$
    – PetaGlz
    Commented Mar 18, 2019 at 20:28
  • $\begingroup$ I just updated my problem since I realized that I wasn't described my problem well enough, sorry about that, could you check the update please? $\endgroup$
    – PetaGlz
    Commented Mar 18, 2019 at 20:29
  • $\begingroup$ Hey Ross! Thanks for the update!! the last formula involvong a is great, but I'm kinda wondering how did u get that. could you please explain that to me as well? $\endgroup$
    – PetaGlz
    Commented Mar 18, 2019 at 20:53
  • $\begingroup$ It is just the standard factoring of the difference of squares. You can multiply it out to see it works. For example, if $N=24=2^33$ we can have $n+m=12,n-m=2,n=7,m=5, n^2-m^2=49-25=24$ or $n+m=5,n-m=4,n=5,m=1,n^2-m^2=5^2-1^2=24$ $\endgroup$ Commented Mar 18, 2019 at 20:57
  • $\begingroup$ If you are doing number theory this factorization should be the first thing you think of when you see the difference of squares. It comes up all the time. $\endgroup$ Commented Mar 18, 2019 at 20:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .