1

I need to solve $$x(x-1)(x-2) = 2y$$ to find $x$ given $y$. It is known that both $x$ and $y$ are positive integers. Is there an easier way than using cube root formulae?

Edit 1: People have requested context. Here is the actual problem. There is a set $S_1$ containing $x$ distinct elements. Then another set $S_2$ is constructed from all possible triplets of elements in $S_1$, under the following additional conditions:

  1. All elements in each triplet must be distinct
  2. Permutation of the last two elements in the triplet is considered the same element. For example, triplet (A,B,C) is considered identical to the triplet (A,C,B) but distinct from (B,A,C).

I know $y$, the size of the set $S_2$, and I would like to find $x$, the size of the original set. It is not hard to figure out that $x$ and $y$ are related via the equation above. I need a function that solves the above equation for $x$ given a valid $y$. By valid I mean that I will only ever use the values of $y$ that have originally been constructed from some positive integer $x$ using the above equation.

I hope this helps with context requirements

  • 2
    You should add an attempt to your question and research efforts – tryst with freedom Aug 31 '21 at 06:40
  • @Buraian There are none currently. I am asking which direction to go. My idea is to is to go the cubic root direction, but it sounds messy – Aleksejs Fomins Aug 31 '21 at 06:42
  • 1
    It's basically a number theory question, so to work it out you can try case with $x$ odd and $x$ even, maybe write a program for case work and check for patterns – tryst with freedom Aug 31 '21 at 06:42
  • When $x \geq 3$, you always have a solution, because if you have $3$ consecutive integers, at least one of them must be even. Therefore, the product of these $3$ integers must be even. – user2661923 Aug 31 '21 at 06:55
  • If you have a particular $y$ then it shouldn't be too hard otherwise I think cube root is the way to go, also is there any context to this question, i.e is this a part of a larger question? – kingW3 Aug 31 '21 at 07:02
  • Just to be clear about the question, you are looking for solutions involving positive integers only, correct? While it is true that there is an integer solution for $ \ y \ $ for every integer $ \ x \ge 3 \ \ , $ there is not a positive integer solution for $ \ x \ $ for every positive integer $ \ y \ \ . $ You are looking for consecutive integer factors of $ \ 2y \ : \ $ what happens if $ \ y \ $ is prime? Consider that the left side is $ \ n · (n-1) · (n-2) \ = \ nPk \ = \ \frac{n!}{(n-3)!} \ \ ; \ y = 168 \ $ has an integer solution for $ \ x \ $ , but $ \ y = 167 \ $ does not. –  Aug 31 '21 at 08:13
  • 1
    @Buraian "Context" isn't all about attempt and research efforts - "source" is also excellent context (e.g. book+chapter, part of a larger problem, etc.), and like here when the user cannot start the question, then we can ask for a source instead. – user1729 Aug 31 '21 at 09:05
  • 1
    Per the comment of @kingW3, I advise against trying to focus on a particular value of $y$. Instead, as some of the responses have indicated (including mine), the problem immediately succumbs to considering all possible values of $x$. Note that for each choice of $x$, only one choice of $y$ is possible. – user2661923 Aug 31 '21 at 10:12
  • For $x > 2$, $(x-1)^3 > x(x-1)(x-2) > (x-2)^3$. This means for any valid $y$, $$(x-1)^3 > 2y > (x-2)^3 \iff x-1 > \sqrt[3]{2y} > x-2 \implies x = 1 + \left\lceil \sqrt[3]{2y} \right\rceil$$ – achille hui Aug 31 '21 at 11:06
  • @achillehui Amazing, exactly what I was looking for. I would accept this answer if you wish to write it as one – Aleksejs Fomins Aug 31 '21 at 11:52
  • 1
    I don't understand. Why is the comment of @achillehui preferable to the formula $y = \frac{x(x-1)(x-2)}{2}$? His comment specifies for any valid $y$, but leaves open the issue of deciding which values of $y$ are valid. – user2661923 Sep 01 '21 at 02:31
  • 1
    @user2661923 look at Edit1 section of question. The reason OP ask this question is he/she already has a bunch of valid $y$ and want a simple way to compute corresponding $x$. – achille hui Sep 01 '21 at 03:34
  • @achillehui Nice rebuttal. – user2661923 Sep 01 '21 at 06:09

1 Answers1

3

Comment expanded to answer per request.

For any $x > 2$, we have

$$(x-1)^3 = (x-1)(x^2-2x+1) > x(x-1)(x-2) > (x-2)^3$$ This means for any valid $y$ (i.e one satsifies $2y = x(x-1)(x-2)$ for some $x$),

$$(x-1)^3 > 2y > (x-2)^3 \implies (x-1) > \sqrt[3]{2y} > (x-2)$$ Since $x$ is supposed to be an integer, this leads to $$x = 1 + \left\lceil \sqrt[3]{2y} \right\rceil = 2 + \left\lfloor \sqrt[3]{2y} \right\rfloor$$

achille hui
  • 122,701