What is the smallest integer greater than 1 such that $frac12$ of it is a perfect square and $frac15$ of it...












29















What is the smallest integer greater than 1 such that $frac12$ of it is a perfect square and $frac15$ of it is a perfect fifth power?




I have tried multiplying every perfect square (up to 400 by two and checking if it is a perfect 5th power, but still nothing. I don't know what to do at this point.










share|cite|improve this question




















  • 8




    It has to be divisible by $5$ and $2$ so you are looking for a multiple of $10$. Working with perfect fifths will get you through the numbers faster. The number $500000$ works so you can work down from there.
    – John Douma
    Oct 29 '18 at 14:20








  • 1




    For the record: this question is currently on the SE Hot Questions list.
    – Bill Dubuque
    Oct 29 '18 at 18:00






  • 2




    @BillDubuque That's what dragged me from StackOverflow to throw some code at these math people.
    – Greg Schmit
    Oct 29 '18 at 18:32










  • @JohnDouma, what do you mean "work down from there"? You gave the answer already.
    – Wildcard
    Oct 30 '18 at 0:57








  • 3




    @Wildcard I simply wanted to place a bounds on the search. The smallest number can't be larger than $500000$. Also, the poster didn't know that this was the answer.
    – John Douma
    Oct 30 '18 at 1:15


















29















What is the smallest integer greater than 1 such that $frac12$ of it is a perfect square and $frac15$ of it is a perfect fifth power?




I have tried multiplying every perfect square (up to 400 by two and checking if it is a perfect 5th power, but still nothing. I don't know what to do at this point.










share|cite|improve this question




















  • 8




    It has to be divisible by $5$ and $2$ so you are looking for a multiple of $10$. Working with perfect fifths will get you through the numbers faster. The number $500000$ works so you can work down from there.
    – John Douma
    Oct 29 '18 at 14:20








  • 1




    For the record: this question is currently on the SE Hot Questions list.
    – Bill Dubuque
    Oct 29 '18 at 18:00






  • 2




    @BillDubuque That's what dragged me from StackOverflow to throw some code at these math people.
    – Greg Schmit
    Oct 29 '18 at 18:32










  • @JohnDouma, what do you mean "work down from there"? You gave the answer already.
    – Wildcard
    Oct 30 '18 at 0:57








  • 3




    @Wildcard I simply wanted to place a bounds on the search. The smallest number can't be larger than $500000$. Also, the poster didn't know that this was the answer.
    – John Douma
    Oct 30 '18 at 1:15
















29












29








29


2






What is the smallest integer greater than 1 such that $frac12$ of it is a perfect square and $frac15$ of it is a perfect fifth power?




I have tried multiplying every perfect square (up to 400 by two and checking if it is a perfect 5th power, but still nothing. I don't know what to do at this point.










share|cite|improve this question
















What is the smallest integer greater than 1 such that $frac12$ of it is a perfect square and $frac15$ of it is a perfect fifth power?




I have tried multiplying every perfect square (up to 400 by two and checking if it is a perfect 5th power, but still nothing. I don't know what to do at this point.







algebra-precalculus diophantine-equations integers perfect-powers






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Nov 28 '18 at 1:43









Servaes

22.4k33793




22.4k33793










asked Oct 29 '18 at 14:15









J. DOEE

16927




16927








  • 8




    It has to be divisible by $5$ and $2$ so you are looking for a multiple of $10$. Working with perfect fifths will get you through the numbers faster. The number $500000$ works so you can work down from there.
    – John Douma
    Oct 29 '18 at 14:20








  • 1




    For the record: this question is currently on the SE Hot Questions list.
    – Bill Dubuque
    Oct 29 '18 at 18:00






  • 2




    @BillDubuque That's what dragged me from StackOverflow to throw some code at these math people.
    – Greg Schmit
    Oct 29 '18 at 18:32










  • @JohnDouma, what do you mean "work down from there"? You gave the answer already.
    – Wildcard
    Oct 30 '18 at 0:57








  • 3




    @Wildcard I simply wanted to place a bounds on the search. The smallest number can't be larger than $500000$. Also, the poster didn't know that this was the answer.
    – John Douma
    Oct 30 '18 at 1:15
















  • 8




    It has to be divisible by $5$ and $2$ so you are looking for a multiple of $10$. Working with perfect fifths will get you through the numbers faster. The number $500000$ works so you can work down from there.
    – John Douma
    Oct 29 '18 at 14:20








  • 1




    For the record: this question is currently on the SE Hot Questions list.
    – Bill Dubuque
    Oct 29 '18 at 18:00






  • 2




    @BillDubuque That's what dragged me from StackOverflow to throw some code at these math people.
    – Greg Schmit
    Oct 29 '18 at 18:32










  • @JohnDouma, what do you mean "work down from there"? You gave the answer already.
    – Wildcard
    Oct 30 '18 at 0:57








  • 3




    @Wildcard I simply wanted to place a bounds on the search. The smallest number can't be larger than $500000$. Also, the poster didn't know that this was the answer.
    – John Douma
    Oct 30 '18 at 1:15










8




8




It has to be divisible by $5$ and $2$ so you are looking for a multiple of $10$. Working with perfect fifths will get you through the numbers faster. The number $500000$ works so you can work down from there.
– John Douma
Oct 29 '18 at 14:20






It has to be divisible by $5$ and $2$ so you are looking for a multiple of $10$. Working with perfect fifths will get you through the numbers faster. The number $500000$ works so you can work down from there.
– John Douma
Oct 29 '18 at 14:20






1




1




For the record: this question is currently on the SE Hot Questions list.
– Bill Dubuque
Oct 29 '18 at 18:00




For the record: this question is currently on the SE Hot Questions list.
– Bill Dubuque
Oct 29 '18 at 18:00




2




2




@BillDubuque That's what dragged me from StackOverflow to throw some code at these math people.
– Greg Schmit
Oct 29 '18 at 18:32




@BillDubuque That's what dragged me from StackOverflow to throw some code at these math people.
– Greg Schmit
Oct 29 '18 at 18:32












@JohnDouma, what do you mean "work down from there"? You gave the answer already.
– Wildcard
Oct 30 '18 at 0:57






@JohnDouma, what do you mean "work down from there"? You gave the answer already.
– Wildcard
Oct 30 '18 at 0:57






3




3




@Wildcard I simply wanted to place a bounds on the search. The smallest number can't be larger than $500000$. Also, the poster didn't know that this was the answer.
– John Douma
Oct 30 '18 at 1:15






@Wildcard I simply wanted to place a bounds on the search. The smallest number can't be larger than $500000$. Also, the poster didn't know that this was the answer.
– John Douma
Oct 30 '18 at 1:15












6 Answers
6






active

oldest

votes


















14














This is like code golf...



The answer is 500000.



Proof by computation: (in R)



> x=(1:10)^5*5
> x
[1] 5 160 1215 5120 15625 38880 84035 163840
[9] 295245 500000
> sqrt(x/2)
[1] 1.581139 8.944272 24.647515 50.596443 88.388348
[6] 139.427400 204.981707 286.216701 384.216736 500.000000


Done.






share|cite|improve this answer

















  • 18




    But... the OP didn't ask how to (in general) FIND the answer. They asked what the answer was, presumably with the minimal proof needed to verify it. I joked about code golf because I tried to give the shortest, most transparent possible demonstration that the result was correct.
    – user11599
    Oct 30 '18 at 7:06








  • 1




    @GregSchmit In a sense, this is "proof by inspection". You claim it is 500000. You prove 500000 has the property, and that the 9 candidates less than it don't. QED. (But the computer program goes backwards). Alternatively, it is a proof by a form of induction. ;)
    – Yakk
    Oct 30 '18 at 20:08








  • 2




    @user11599 After thinking about it, even though this technically answers the question, I think it's important not to just show the right answer, but to show how you would figure it out if you didn't already know it a priori.
    – Greg Schmit
    Oct 31 '18 at 18:48



















88














The number is clearly a multiple of $5$ and $2$. We look for the smallest, so we assume that it has no more prime factors.



So let $n=2^a5^b$. Since $n/2$ is a square, then $a-1$ and $b$ are even. Since $n/5$ is a fifth power, $a$ and $b-1$ are multiples of $5$. Then $a=5$ and $b=6$.






share|cite|improve this answer

















  • 9




    Why can you assume that it has no other prime factors?
    – Servaes
    Oct 29 '18 at 14:31






  • 20




    @Servaes Because the question is asking for the least number meeting the criterion. Adding in any other prime factors would give a larger number...
    – twalberg
    Oct 29 '18 at 15:21






  • 12




    @Servaes: They can always be divided. Say, $n$ is a solution with an additional prime factor $p$ of order $c$. Since $pne 2$, $p^c$ is also a factor of $n/2$ which is a square, thus $c$ has to be even and $(n/p^c)/2$ is a square as well. In the same way $(n/p^c)/5$ is a fifth power, so $n/p^c$ is a smaller solution.
    – mlk
    Oct 29 '18 at 15:23








  • 13




    @ajotatxe It would be helpful to add mlk's analysis (or similar) to the answer to help clarify the point, as it's not necessarily obvious.
    – R.M.
    Oct 29 '18 at 15:32






  • 13




    @R.M. I don't agree, I think it is totally obvious as written.
    – Morgan Rodgers
    Oct 29 '18 at 16:34



















32














Here's a very unsophisticated approach: Let $n$ be the smallest such integer. Then there exist integers $a$ and $b$ such that $n=5a^5$ and $n=2b^2$. It follows that $a$ is a multiple of $2$, say $a=2a_1$, and $b$ is a multiple of $5$, say $b=5b_1$. Then
$$n=2^5cdot5cdot a_1^5qquadtext{ and }qquad n=2cdot5^2cdot b_1^2.$$
This in turn shows that $a_1$ is a multiple of $5$, say $a_1=5a_2$, and $b_1$ is a multiple of $2$, say $b_1=2b_2$. Then
$$n=2^5cdot5^6cdot a_2^5qquadtext{ and }qquad n=2^3cdot5^2cdot b_2^2.$$
This in turn shows that $b_2$ is a multiple of both $2$ and $5^2$, say $b_2=2cdot5^2cdot b_3$. Then
$$n=2^5cdot5^6cdot a_2^5qquadtext{ and }qquad n=2^5cdot5^6cdot b_3^2.$$
This shows that $ngeq2^5cdot5^6$, and as you might expect a quick check shows that $n=2^5cdot5^6$ does indeed work, so $n=2^5cdot5^6=500000$.






share|cite|improve this answer





















  • I don't find this unsophisticated - it's like a finite form of infinite descent. Probably ajotatxe has the simpler solution however, when you consider where the prime factors go.
    – theREALyumdub
    Oct 30 '18 at 14:39



















10














I am writing this answer because you said that you were trying a guess and check method. Computers are good at this. A decent algorithm is to have two integers $n_x$ and $n_y$ which start at 1. Then, calculate x by doing $2n_x^2$ and y by doing $5n_y^5$. Check if they are equal; if they are, you found your answer. If not, whichever of $x$ and $y$ are lower, increment that $n$ value (i.e., if $x < y$, then increment $n_x$). Recalculate $x$ and $y$ and repeat until they are the same.



Here is an example implementation in Python using generators:



class SpecialSquareGenerator:

def __init__(self, n=0):
self.n = n

def __iter__(self):
return self

def __next__(self):
self.n += 1
return self.n, 2*(self.n**2)

class SpecialFifthGenerator:

def __init__(self, n=0):
self.n = n

def __iter__(self):
return self

def __next__(self):
self.n += 1
return self.n, 5*(self.n**5)

def special_square():
n = 0;
ss = SpecialSquareGenerator()
sf = SpecialFifthGenerator()
nx, x = next(ss)
ny, y = next(sf)
print("{0}: {1}t{2}: {3}".format(nx, x, ny, y))
while True:
if (x == y): return x
if x < y:
nx, x = next(ss)
else:
ny, y = next(sf)
print("{0}: {1}t{2}: {3}".format(nx, x, ny, y))

if __name__ == "__main__":
print(special_square())


Running it returns the right answer:



gns-mac1:sandbox gns$ python3 special_square.py 
1: 2 1: 5
2: 8 1: 5
2: 8 2: 160
3: 18 2: 160
...(output omitted)
494: 488072 10: 500000
495: 490050 10: 500000
496: 492032 10: 500000
497: 494018 10: 500000
498: 496008 10: 500000
499: 498002 10: 500000
500: 500000 10: 500000
500000


Of course, the mathematical approach is better for understanding the problem. But if you need to guess and check, then computers are the tool for that.



P.S.



There is another way to exhaustively search for the solution. You can take sequential numbers and try dividing them by 2 (or 5) and then taking the square root (or fifth root) and then checking if that result is an integer for both operations. There are two downsides to this approach:




  • You have to decide if a floating point number is supposed to represent an integer. This is hard for computers and language implementations to do because computers only have a fixed set of digits to represent floating point numbers.

  • The search space is greater (by order of $n^2$). So that means that you should expect to take longer to reach the same answer, given the same hardware.


P.S.S.



There are faster ways to implement both my algorithm, and the other I mentioned in the postscript. For example, you can double $n$ each time and then when you overshoot, use binary search in the space between the last $n$ and the one that overshot.






share|cite|improve this answer























  • Nice -- but as you hinted, it depends on whether (assuming this is a class) the teacher expects an analytic proof or not :-)
    – Carl Witthoft
    Oct 29 '18 at 19:03










  • @CarlWitthoft Yes, though because I'm a computer scientist I have to say that the student could prove that this program is guaranteed to provide the lowest integer that adheres to the constraints. It's actually similar to how they proved the 4 color theorem by using a computer program to iterate over a bunch of graphs. But you're probably right that the teacher wants them to use math, not computer programs. :)
    – Greg Schmit
    Oct 29 '18 at 19:45






  • 2




    @numbermaniac That's why I used the particular algorithm that I did, which doesn't require the computation of square roots or fifth roots and doesn't require any floating point math (to avoid rounding errors). It executes in 0.033s on a MBP in Python 3.6.
    – Greg Schmit
    Oct 30 '18 at 2:16






  • 1




    I bet it took substantially more than 8.7 seconds to write it though. Mathematica wins on this one!
    – Mike Spivey
    Oct 30 '18 at 9:45






  • 1




    Here's a Python two-liner as an alternative: import itertools; next(10*i for i in itertools.count(1) if round((5*i)**0.5)**2 == 5*i and round((2*i)**0.2)**5 == 2*i)
    – Eric Duminil
    Oct 30 '18 at 11:23



















0














Hint: Let the required number be x:



$frac{1}{2}x= A^2$



$frac{1}{5}x= B^5$



$frac{1}{2}x+frac{1}{5}x =A^2+B^5$



$frac{5x+2x}{10}=A^2+B^5$



$7x=10(A^2+B^5)$



$x=10k$; $k ∈ N $.



So x is a power of 10.



The smallest 5th power of 10 is $10^5$ so the number must be $5times 10^5=500000$.






share|cite|improve this answer





























    0














    All integers of this kind can be written in the form,



    $$k = 5^{10a - 4} 2^{10b - 5} c^{10d}$$



    where $a, b, c, d in mathbb{Z}_{ge 1}$ (or $a, b, c, d$ are non-negative integers)





    Let's make sure this works.



    $$ k/5 = 5^{10a-5} 2^{10b-5} = (5^{2a-1} 2^{2b-1} c^{2d})^5$$



    So, $1/5$ of $k$ is a perfect fifth power.



    $$ k/2 = 5^{10a-4} 2^{10b-6} = (5^{5a-2} 2^{5b-3} c^{5d})^2$$



    So, $1/2$ of $k$ is a perfect square.





    The smallest integer of this kind is the one where $a, b, c, d = 1$ which is $k = 5^6 2^5 = 500000$.





    You can find all integers that follow your definition by using different values of $a, b, c, d$.






    share|cite|improve this answer





















      Your Answer





      StackExchange.ifUsing("editor", function () {
      return StackExchange.using("mathjaxEditing", function () {
      StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
      StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
      });
      });
      }, "mathjax-editing");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "69"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      noCode: true, onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2976181%2fwhat-is-the-smallest-integer-greater-than-1-such-that-frac12-of-it-is-a-perfe%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      6 Answers
      6






      active

      oldest

      votes








      6 Answers
      6






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      14














      This is like code golf...



      The answer is 500000.



      Proof by computation: (in R)



      > x=(1:10)^5*5
      > x
      [1] 5 160 1215 5120 15625 38880 84035 163840
      [9] 295245 500000
      > sqrt(x/2)
      [1] 1.581139 8.944272 24.647515 50.596443 88.388348
      [6] 139.427400 204.981707 286.216701 384.216736 500.000000


      Done.






      share|cite|improve this answer

















      • 18




        But... the OP didn't ask how to (in general) FIND the answer. They asked what the answer was, presumably with the minimal proof needed to verify it. I joked about code golf because I tried to give the shortest, most transparent possible demonstration that the result was correct.
        – user11599
        Oct 30 '18 at 7:06








      • 1




        @GregSchmit In a sense, this is "proof by inspection". You claim it is 500000. You prove 500000 has the property, and that the 9 candidates less than it don't. QED. (But the computer program goes backwards). Alternatively, it is a proof by a form of induction. ;)
        – Yakk
        Oct 30 '18 at 20:08








      • 2




        @user11599 After thinking about it, even though this technically answers the question, I think it's important not to just show the right answer, but to show how you would figure it out if you didn't already know it a priori.
        – Greg Schmit
        Oct 31 '18 at 18:48
















      14














      This is like code golf...



      The answer is 500000.



      Proof by computation: (in R)



      > x=(1:10)^5*5
      > x
      [1] 5 160 1215 5120 15625 38880 84035 163840
      [9] 295245 500000
      > sqrt(x/2)
      [1] 1.581139 8.944272 24.647515 50.596443 88.388348
      [6] 139.427400 204.981707 286.216701 384.216736 500.000000


      Done.






      share|cite|improve this answer

















      • 18




        But... the OP didn't ask how to (in general) FIND the answer. They asked what the answer was, presumably with the minimal proof needed to verify it. I joked about code golf because I tried to give the shortest, most transparent possible demonstration that the result was correct.
        – user11599
        Oct 30 '18 at 7:06








      • 1




        @GregSchmit In a sense, this is "proof by inspection". You claim it is 500000. You prove 500000 has the property, and that the 9 candidates less than it don't. QED. (But the computer program goes backwards). Alternatively, it is a proof by a form of induction. ;)
        – Yakk
        Oct 30 '18 at 20:08








      • 2




        @user11599 After thinking about it, even though this technically answers the question, I think it's important not to just show the right answer, but to show how you would figure it out if you didn't already know it a priori.
        – Greg Schmit
        Oct 31 '18 at 18:48














      14












      14








      14






      This is like code golf...



      The answer is 500000.



      Proof by computation: (in R)



      > x=(1:10)^5*5
      > x
      [1] 5 160 1215 5120 15625 38880 84035 163840
      [9] 295245 500000
      > sqrt(x/2)
      [1] 1.581139 8.944272 24.647515 50.596443 88.388348
      [6] 139.427400 204.981707 286.216701 384.216736 500.000000


      Done.






      share|cite|improve this answer












      This is like code golf...



      The answer is 500000.



      Proof by computation: (in R)



      > x=(1:10)^5*5
      > x
      [1] 5 160 1215 5120 15625 38880 84035 163840
      [9] 295245 500000
      > sqrt(x/2)
      [1] 1.581139 8.944272 24.647515 50.596443 88.388348
      [6] 139.427400 204.981707 286.216701 384.216736 500.000000


      Done.







      share|cite|improve this answer












      share|cite|improve this answer



      share|cite|improve this answer










      answered Oct 30 '18 at 1:49









      user11599

      31812




      31812








      • 18




        But... the OP didn't ask how to (in general) FIND the answer. They asked what the answer was, presumably with the minimal proof needed to verify it. I joked about code golf because I tried to give the shortest, most transparent possible demonstration that the result was correct.
        – user11599
        Oct 30 '18 at 7:06








      • 1




        @GregSchmit In a sense, this is "proof by inspection". You claim it is 500000. You prove 500000 has the property, and that the 9 candidates less than it don't. QED. (But the computer program goes backwards). Alternatively, it is a proof by a form of induction. ;)
        – Yakk
        Oct 30 '18 at 20:08








      • 2




        @user11599 After thinking about it, even though this technically answers the question, I think it's important not to just show the right answer, but to show how you would figure it out if you didn't already know it a priori.
        – Greg Schmit
        Oct 31 '18 at 18:48














      • 18




        But... the OP didn't ask how to (in general) FIND the answer. They asked what the answer was, presumably with the minimal proof needed to verify it. I joked about code golf because I tried to give the shortest, most transparent possible demonstration that the result was correct.
        – user11599
        Oct 30 '18 at 7:06








      • 1




        @GregSchmit In a sense, this is "proof by inspection". You claim it is 500000. You prove 500000 has the property, and that the 9 candidates less than it don't. QED. (But the computer program goes backwards). Alternatively, it is a proof by a form of induction. ;)
        – Yakk
        Oct 30 '18 at 20:08








      • 2




        @user11599 After thinking about it, even though this technically answers the question, I think it's important not to just show the right answer, but to show how you would figure it out if you didn't already know it a priori.
        – Greg Schmit
        Oct 31 '18 at 18:48








      18




      18




      But... the OP didn't ask how to (in general) FIND the answer. They asked what the answer was, presumably with the minimal proof needed to verify it. I joked about code golf because I tried to give the shortest, most transparent possible demonstration that the result was correct.
      – user11599
      Oct 30 '18 at 7:06






      But... the OP didn't ask how to (in general) FIND the answer. They asked what the answer was, presumably with the minimal proof needed to verify it. I joked about code golf because I tried to give the shortest, most transparent possible demonstration that the result was correct.
      – user11599
      Oct 30 '18 at 7:06






      1




      1




      @GregSchmit In a sense, this is "proof by inspection". You claim it is 500000. You prove 500000 has the property, and that the 9 candidates less than it don't. QED. (But the computer program goes backwards). Alternatively, it is a proof by a form of induction. ;)
      – Yakk
      Oct 30 '18 at 20:08






      @GregSchmit In a sense, this is "proof by inspection". You claim it is 500000. You prove 500000 has the property, and that the 9 candidates less than it don't. QED. (But the computer program goes backwards). Alternatively, it is a proof by a form of induction. ;)
      – Yakk
      Oct 30 '18 at 20:08






      2




      2




      @user11599 After thinking about it, even though this technically answers the question, I think it's important not to just show the right answer, but to show how you would figure it out if you didn't already know it a priori.
      – Greg Schmit
      Oct 31 '18 at 18:48




      @user11599 After thinking about it, even though this technically answers the question, I think it's important not to just show the right answer, but to show how you would figure it out if you didn't already know it a priori.
      – Greg Schmit
      Oct 31 '18 at 18:48











      88














      The number is clearly a multiple of $5$ and $2$. We look for the smallest, so we assume that it has no more prime factors.



      So let $n=2^a5^b$. Since $n/2$ is a square, then $a-1$ and $b$ are even. Since $n/5$ is a fifth power, $a$ and $b-1$ are multiples of $5$. Then $a=5$ and $b=6$.






      share|cite|improve this answer

















      • 9




        Why can you assume that it has no other prime factors?
        – Servaes
        Oct 29 '18 at 14:31






      • 20




        @Servaes Because the question is asking for the least number meeting the criterion. Adding in any other prime factors would give a larger number...
        – twalberg
        Oct 29 '18 at 15:21






      • 12




        @Servaes: They can always be divided. Say, $n$ is a solution with an additional prime factor $p$ of order $c$. Since $pne 2$, $p^c$ is also a factor of $n/2$ which is a square, thus $c$ has to be even and $(n/p^c)/2$ is a square as well. In the same way $(n/p^c)/5$ is a fifth power, so $n/p^c$ is a smaller solution.
        – mlk
        Oct 29 '18 at 15:23








      • 13




        @ajotatxe It would be helpful to add mlk's analysis (or similar) to the answer to help clarify the point, as it's not necessarily obvious.
        – R.M.
        Oct 29 '18 at 15:32






      • 13




        @R.M. I don't agree, I think it is totally obvious as written.
        – Morgan Rodgers
        Oct 29 '18 at 16:34
















      88














      The number is clearly a multiple of $5$ and $2$. We look for the smallest, so we assume that it has no more prime factors.



      So let $n=2^a5^b$. Since $n/2$ is a square, then $a-1$ and $b$ are even. Since $n/5$ is a fifth power, $a$ and $b-1$ are multiples of $5$. Then $a=5$ and $b=6$.






      share|cite|improve this answer

















      • 9




        Why can you assume that it has no other prime factors?
        – Servaes
        Oct 29 '18 at 14:31






      • 20




        @Servaes Because the question is asking for the least number meeting the criterion. Adding in any other prime factors would give a larger number...
        – twalberg
        Oct 29 '18 at 15:21






      • 12




        @Servaes: They can always be divided. Say, $n$ is a solution with an additional prime factor $p$ of order $c$. Since $pne 2$, $p^c$ is also a factor of $n/2$ which is a square, thus $c$ has to be even and $(n/p^c)/2$ is a square as well. In the same way $(n/p^c)/5$ is a fifth power, so $n/p^c$ is a smaller solution.
        – mlk
        Oct 29 '18 at 15:23








      • 13




        @ajotatxe It would be helpful to add mlk's analysis (or similar) to the answer to help clarify the point, as it's not necessarily obvious.
        – R.M.
        Oct 29 '18 at 15:32






      • 13




        @R.M. I don't agree, I think it is totally obvious as written.
        – Morgan Rodgers
        Oct 29 '18 at 16:34














      88












      88








      88






      The number is clearly a multiple of $5$ and $2$. We look for the smallest, so we assume that it has no more prime factors.



      So let $n=2^a5^b$. Since $n/2$ is a square, then $a-1$ and $b$ are even. Since $n/5$ is a fifth power, $a$ and $b-1$ are multiples of $5$. Then $a=5$ and $b=6$.






      share|cite|improve this answer












      The number is clearly a multiple of $5$ and $2$. We look for the smallest, so we assume that it has no more prime factors.



      So let $n=2^a5^b$. Since $n/2$ is a square, then $a-1$ and $b$ are even. Since $n/5$ is a fifth power, $a$ and $b-1$ are multiples of $5$. Then $a=5$ and $b=6$.







      share|cite|improve this answer












      share|cite|improve this answer



      share|cite|improve this answer










      answered Oct 29 '18 at 14:24









      ajotatxe

      53.4k23890




      53.4k23890








      • 9




        Why can you assume that it has no other prime factors?
        – Servaes
        Oct 29 '18 at 14:31






      • 20




        @Servaes Because the question is asking for the least number meeting the criterion. Adding in any other prime factors would give a larger number...
        – twalberg
        Oct 29 '18 at 15:21






      • 12




        @Servaes: They can always be divided. Say, $n$ is a solution with an additional prime factor $p$ of order $c$. Since $pne 2$, $p^c$ is also a factor of $n/2$ which is a square, thus $c$ has to be even and $(n/p^c)/2$ is a square as well. In the same way $(n/p^c)/5$ is a fifth power, so $n/p^c$ is a smaller solution.
        – mlk
        Oct 29 '18 at 15:23








      • 13




        @ajotatxe It would be helpful to add mlk's analysis (or similar) to the answer to help clarify the point, as it's not necessarily obvious.
        – R.M.
        Oct 29 '18 at 15:32






      • 13




        @R.M. I don't agree, I think it is totally obvious as written.
        – Morgan Rodgers
        Oct 29 '18 at 16:34














      • 9




        Why can you assume that it has no other prime factors?
        – Servaes
        Oct 29 '18 at 14:31






      • 20




        @Servaes Because the question is asking for the least number meeting the criterion. Adding in any other prime factors would give a larger number...
        – twalberg
        Oct 29 '18 at 15:21






      • 12




        @Servaes: They can always be divided. Say, $n$ is a solution with an additional prime factor $p$ of order $c$. Since $pne 2$, $p^c$ is also a factor of $n/2$ which is a square, thus $c$ has to be even and $(n/p^c)/2$ is a square as well. In the same way $(n/p^c)/5$ is a fifth power, so $n/p^c$ is a smaller solution.
        – mlk
        Oct 29 '18 at 15:23








      • 13




        @ajotatxe It would be helpful to add mlk's analysis (or similar) to the answer to help clarify the point, as it's not necessarily obvious.
        – R.M.
        Oct 29 '18 at 15:32






      • 13




        @R.M. I don't agree, I think it is totally obvious as written.
        – Morgan Rodgers
        Oct 29 '18 at 16:34








      9




      9




      Why can you assume that it has no other prime factors?
      – Servaes
      Oct 29 '18 at 14:31




      Why can you assume that it has no other prime factors?
      – Servaes
      Oct 29 '18 at 14:31




      20




      20




      @Servaes Because the question is asking for the least number meeting the criterion. Adding in any other prime factors would give a larger number...
      – twalberg
      Oct 29 '18 at 15:21




      @Servaes Because the question is asking for the least number meeting the criterion. Adding in any other prime factors would give a larger number...
      – twalberg
      Oct 29 '18 at 15:21




      12




      12




      @Servaes: They can always be divided. Say, $n$ is a solution with an additional prime factor $p$ of order $c$. Since $pne 2$, $p^c$ is also a factor of $n/2$ which is a square, thus $c$ has to be even and $(n/p^c)/2$ is a square as well. In the same way $(n/p^c)/5$ is a fifth power, so $n/p^c$ is a smaller solution.
      – mlk
      Oct 29 '18 at 15:23






      @Servaes: They can always be divided. Say, $n$ is a solution with an additional prime factor $p$ of order $c$. Since $pne 2$, $p^c$ is also a factor of $n/2$ which is a square, thus $c$ has to be even and $(n/p^c)/2$ is a square as well. In the same way $(n/p^c)/5$ is a fifth power, so $n/p^c$ is a smaller solution.
      – mlk
      Oct 29 '18 at 15:23






      13




      13




      @ajotatxe It would be helpful to add mlk's analysis (or similar) to the answer to help clarify the point, as it's not necessarily obvious.
      – R.M.
      Oct 29 '18 at 15:32




      @ajotatxe It would be helpful to add mlk's analysis (or similar) to the answer to help clarify the point, as it's not necessarily obvious.
      – R.M.
      Oct 29 '18 at 15:32




      13




      13




      @R.M. I don't agree, I think it is totally obvious as written.
      – Morgan Rodgers
      Oct 29 '18 at 16:34




      @R.M. I don't agree, I think it is totally obvious as written.
      – Morgan Rodgers
      Oct 29 '18 at 16:34











      32














      Here's a very unsophisticated approach: Let $n$ be the smallest such integer. Then there exist integers $a$ and $b$ such that $n=5a^5$ and $n=2b^2$. It follows that $a$ is a multiple of $2$, say $a=2a_1$, and $b$ is a multiple of $5$, say $b=5b_1$. Then
      $$n=2^5cdot5cdot a_1^5qquadtext{ and }qquad n=2cdot5^2cdot b_1^2.$$
      This in turn shows that $a_1$ is a multiple of $5$, say $a_1=5a_2$, and $b_1$ is a multiple of $2$, say $b_1=2b_2$. Then
      $$n=2^5cdot5^6cdot a_2^5qquadtext{ and }qquad n=2^3cdot5^2cdot b_2^2.$$
      This in turn shows that $b_2$ is a multiple of both $2$ and $5^2$, say $b_2=2cdot5^2cdot b_3$. Then
      $$n=2^5cdot5^6cdot a_2^5qquadtext{ and }qquad n=2^5cdot5^6cdot b_3^2.$$
      This shows that $ngeq2^5cdot5^6$, and as you might expect a quick check shows that $n=2^5cdot5^6$ does indeed work, so $n=2^5cdot5^6=500000$.






      share|cite|improve this answer





















      • I don't find this unsophisticated - it's like a finite form of infinite descent. Probably ajotatxe has the simpler solution however, when you consider where the prime factors go.
        – theREALyumdub
        Oct 30 '18 at 14:39
















      32














      Here's a very unsophisticated approach: Let $n$ be the smallest such integer. Then there exist integers $a$ and $b$ such that $n=5a^5$ and $n=2b^2$. It follows that $a$ is a multiple of $2$, say $a=2a_1$, and $b$ is a multiple of $5$, say $b=5b_1$. Then
      $$n=2^5cdot5cdot a_1^5qquadtext{ and }qquad n=2cdot5^2cdot b_1^2.$$
      This in turn shows that $a_1$ is a multiple of $5$, say $a_1=5a_2$, and $b_1$ is a multiple of $2$, say $b_1=2b_2$. Then
      $$n=2^5cdot5^6cdot a_2^5qquadtext{ and }qquad n=2^3cdot5^2cdot b_2^2.$$
      This in turn shows that $b_2$ is a multiple of both $2$ and $5^2$, say $b_2=2cdot5^2cdot b_3$. Then
      $$n=2^5cdot5^6cdot a_2^5qquadtext{ and }qquad n=2^5cdot5^6cdot b_3^2.$$
      This shows that $ngeq2^5cdot5^6$, and as you might expect a quick check shows that $n=2^5cdot5^6$ does indeed work, so $n=2^5cdot5^6=500000$.






      share|cite|improve this answer





















      • I don't find this unsophisticated - it's like a finite form of infinite descent. Probably ajotatxe has the simpler solution however, when you consider where the prime factors go.
        – theREALyumdub
        Oct 30 '18 at 14:39














      32












      32








      32






      Here's a very unsophisticated approach: Let $n$ be the smallest such integer. Then there exist integers $a$ and $b$ such that $n=5a^5$ and $n=2b^2$. It follows that $a$ is a multiple of $2$, say $a=2a_1$, and $b$ is a multiple of $5$, say $b=5b_1$. Then
      $$n=2^5cdot5cdot a_1^5qquadtext{ and }qquad n=2cdot5^2cdot b_1^2.$$
      This in turn shows that $a_1$ is a multiple of $5$, say $a_1=5a_2$, and $b_1$ is a multiple of $2$, say $b_1=2b_2$. Then
      $$n=2^5cdot5^6cdot a_2^5qquadtext{ and }qquad n=2^3cdot5^2cdot b_2^2.$$
      This in turn shows that $b_2$ is a multiple of both $2$ and $5^2$, say $b_2=2cdot5^2cdot b_3$. Then
      $$n=2^5cdot5^6cdot a_2^5qquadtext{ and }qquad n=2^5cdot5^6cdot b_3^2.$$
      This shows that $ngeq2^5cdot5^6$, and as you might expect a quick check shows that $n=2^5cdot5^6$ does indeed work, so $n=2^5cdot5^6=500000$.






      share|cite|improve this answer












      Here's a very unsophisticated approach: Let $n$ be the smallest such integer. Then there exist integers $a$ and $b$ such that $n=5a^5$ and $n=2b^2$. It follows that $a$ is a multiple of $2$, say $a=2a_1$, and $b$ is a multiple of $5$, say $b=5b_1$. Then
      $$n=2^5cdot5cdot a_1^5qquadtext{ and }qquad n=2cdot5^2cdot b_1^2.$$
      This in turn shows that $a_1$ is a multiple of $5$, say $a_1=5a_2$, and $b_1$ is a multiple of $2$, say $b_1=2b_2$. Then
      $$n=2^5cdot5^6cdot a_2^5qquadtext{ and }qquad n=2^3cdot5^2cdot b_2^2.$$
      This in turn shows that $b_2$ is a multiple of both $2$ and $5^2$, say $b_2=2cdot5^2cdot b_3$. Then
      $$n=2^5cdot5^6cdot a_2^5qquadtext{ and }qquad n=2^5cdot5^6cdot b_3^2.$$
      This shows that $ngeq2^5cdot5^6$, and as you might expect a quick check shows that $n=2^5cdot5^6$ does indeed work, so $n=2^5cdot5^6=500000$.







      share|cite|improve this answer












      share|cite|improve this answer



      share|cite|improve this answer










      answered Oct 29 '18 at 14:31









      Servaes

      22.4k33793




      22.4k33793












      • I don't find this unsophisticated - it's like a finite form of infinite descent. Probably ajotatxe has the simpler solution however, when you consider where the prime factors go.
        – theREALyumdub
        Oct 30 '18 at 14:39


















      • I don't find this unsophisticated - it's like a finite form of infinite descent. Probably ajotatxe has the simpler solution however, when you consider where the prime factors go.
        – theREALyumdub
        Oct 30 '18 at 14:39
















      I don't find this unsophisticated - it's like a finite form of infinite descent. Probably ajotatxe has the simpler solution however, when you consider where the prime factors go.
      – theREALyumdub
      Oct 30 '18 at 14:39




      I don't find this unsophisticated - it's like a finite form of infinite descent. Probably ajotatxe has the simpler solution however, when you consider where the prime factors go.
      – theREALyumdub
      Oct 30 '18 at 14:39











      10














      I am writing this answer because you said that you were trying a guess and check method. Computers are good at this. A decent algorithm is to have two integers $n_x$ and $n_y$ which start at 1. Then, calculate x by doing $2n_x^2$ and y by doing $5n_y^5$. Check if they are equal; if they are, you found your answer. If not, whichever of $x$ and $y$ are lower, increment that $n$ value (i.e., if $x < y$, then increment $n_x$). Recalculate $x$ and $y$ and repeat until they are the same.



      Here is an example implementation in Python using generators:



      class SpecialSquareGenerator:

      def __init__(self, n=0):
      self.n = n

      def __iter__(self):
      return self

      def __next__(self):
      self.n += 1
      return self.n, 2*(self.n**2)

      class SpecialFifthGenerator:

      def __init__(self, n=0):
      self.n = n

      def __iter__(self):
      return self

      def __next__(self):
      self.n += 1
      return self.n, 5*(self.n**5)

      def special_square():
      n = 0;
      ss = SpecialSquareGenerator()
      sf = SpecialFifthGenerator()
      nx, x = next(ss)
      ny, y = next(sf)
      print("{0}: {1}t{2}: {3}".format(nx, x, ny, y))
      while True:
      if (x == y): return x
      if x < y:
      nx, x = next(ss)
      else:
      ny, y = next(sf)
      print("{0}: {1}t{2}: {3}".format(nx, x, ny, y))

      if __name__ == "__main__":
      print(special_square())


      Running it returns the right answer:



      gns-mac1:sandbox gns$ python3 special_square.py 
      1: 2 1: 5
      2: 8 1: 5
      2: 8 2: 160
      3: 18 2: 160
      ...(output omitted)
      494: 488072 10: 500000
      495: 490050 10: 500000
      496: 492032 10: 500000
      497: 494018 10: 500000
      498: 496008 10: 500000
      499: 498002 10: 500000
      500: 500000 10: 500000
      500000


      Of course, the mathematical approach is better for understanding the problem. But if you need to guess and check, then computers are the tool for that.



      P.S.



      There is another way to exhaustively search for the solution. You can take sequential numbers and try dividing them by 2 (or 5) and then taking the square root (or fifth root) and then checking if that result is an integer for both operations. There are two downsides to this approach:




      • You have to decide if a floating point number is supposed to represent an integer. This is hard for computers and language implementations to do because computers only have a fixed set of digits to represent floating point numbers.

      • The search space is greater (by order of $n^2$). So that means that you should expect to take longer to reach the same answer, given the same hardware.


      P.S.S.



      There are faster ways to implement both my algorithm, and the other I mentioned in the postscript. For example, you can double $n$ each time and then when you overshoot, use binary search in the space between the last $n$ and the one that overshot.






      share|cite|improve this answer























      • Nice -- but as you hinted, it depends on whether (assuming this is a class) the teacher expects an analytic proof or not :-)
        – Carl Witthoft
        Oct 29 '18 at 19:03










      • @CarlWitthoft Yes, though because I'm a computer scientist I have to say that the student could prove that this program is guaranteed to provide the lowest integer that adheres to the constraints. It's actually similar to how they proved the 4 color theorem by using a computer program to iterate over a bunch of graphs. But you're probably right that the teacher wants them to use math, not computer programs. :)
        – Greg Schmit
        Oct 29 '18 at 19:45






      • 2




        @numbermaniac That's why I used the particular algorithm that I did, which doesn't require the computation of square roots or fifth roots and doesn't require any floating point math (to avoid rounding errors). It executes in 0.033s on a MBP in Python 3.6.
        – Greg Schmit
        Oct 30 '18 at 2:16






      • 1




        I bet it took substantially more than 8.7 seconds to write it though. Mathematica wins on this one!
        – Mike Spivey
        Oct 30 '18 at 9:45






      • 1




        Here's a Python two-liner as an alternative: import itertools; next(10*i for i in itertools.count(1) if round((5*i)**0.5)**2 == 5*i and round((2*i)**0.2)**5 == 2*i)
        – Eric Duminil
        Oct 30 '18 at 11:23
















      10














      I am writing this answer because you said that you were trying a guess and check method. Computers are good at this. A decent algorithm is to have two integers $n_x$ and $n_y$ which start at 1. Then, calculate x by doing $2n_x^2$ and y by doing $5n_y^5$. Check if they are equal; if they are, you found your answer. If not, whichever of $x$ and $y$ are lower, increment that $n$ value (i.e., if $x < y$, then increment $n_x$). Recalculate $x$ and $y$ and repeat until they are the same.



      Here is an example implementation in Python using generators:



      class SpecialSquareGenerator:

      def __init__(self, n=0):
      self.n = n

      def __iter__(self):
      return self

      def __next__(self):
      self.n += 1
      return self.n, 2*(self.n**2)

      class SpecialFifthGenerator:

      def __init__(self, n=0):
      self.n = n

      def __iter__(self):
      return self

      def __next__(self):
      self.n += 1
      return self.n, 5*(self.n**5)

      def special_square():
      n = 0;
      ss = SpecialSquareGenerator()
      sf = SpecialFifthGenerator()
      nx, x = next(ss)
      ny, y = next(sf)
      print("{0}: {1}t{2}: {3}".format(nx, x, ny, y))
      while True:
      if (x == y): return x
      if x < y:
      nx, x = next(ss)
      else:
      ny, y = next(sf)
      print("{0}: {1}t{2}: {3}".format(nx, x, ny, y))

      if __name__ == "__main__":
      print(special_square())


      Running it returns the right answer:



      gns-mac1:sandbox gns$ python3 special_square.py 
      1: 2 1: 5
      2: 8 1: 5
      2: 8 2: 160
      3: 18 2: 160
      ...(output omitted)
      494: 488072 10: 500000
      495: 490050 10: 500000
      496: 492032 10: 500000
      497: 494018 10: 500000
      498: 496008 10: 500000
      499: 498002 10: 500000
      500: 500000 10: 500000
      500000


      Of course, the mathematical approach is better for understanding the problem. But if you need to guess and check, then computers are the tool for that.



      P.S.



      There is another way to exhaustively search for the solution. You can take sequential numbers and try dividing them by 2 (or 5) and then taking the square root (or fifth root) and then checking if that result is an integer for both operations. There are two downsides to this approach:




      • You have to decide if a floating point number is supposed to represent an integer. This is hard for computers and language implementations to do because computers only have a fixed set of digits to represent floating point numbers.

      • The search space is greater (by order of $n^2$). So that means that you should expect to take longer to reach the same answer, given the same hardware.


      P.S.S.



      There are faster ways to implement both my algorithm, and the other I mentioned in the postscript. For example, you can double $n$ each time and then when you overshoot, use binary search in the space between the last $n$ and the one that overshot.






      share|cite|improve this answer























      • Nice -- but as you hinted, it depends on whether (assuming this is a class) the teacher expects an analytic proof or not :-)
        – Carl Witthoft
        Oct 29 '18 at 19:03










      • @CarlWitthoft Yes, though because I'm a computer scientist I have to say that the student could prove that this program is guaranteed to provide the lowest integer that adheres to the constraints. It's actually similar to how they proved the 4 color theorem by using a computer program to iterate over a bunch of graphs. But you're probably right that the teacher wants them to use math, not computer programs. :)
        – Greg Schmit
        Oct 29 '18 at 19:45






      • 2




        @numbermaniac That's why I used the particular algorithm that I did, which doesn't require the computation of square roots or fifth roots and doesn't require any floating point math (to avoid rounding errors). It executes in 0.033s on a MBP in Python 3.6.
        – Greg Schmit
        Oct 30 '18 at 2:16






      • 1




        I bet it took substantially more than 8.7 seconds to write it though. Mathematica wins on this one!
        – Mike Spivey
        Oct 30 '18 at 9:45






      • 1




        Here's a Python two-liner as an alternative: import itertools; next(10*i for i in itertools.count(1) if round((5*i)**0.5)**2 == 5*i and round((2*i)**0.2)**5 == 2*i)
        – Eric Duminil
        Oct 30 '18 at 11:23














      10












      10








      10






      I am writing this answer because you said that you were trying a guess and check method. Computers are good at this. A decent algorithm is to have two integers $n_x$ and $n_y$ which start at 1. Then, calculate x by doing $2n_x^2$ and y by doing $5n_y^5$. Check if they are equal; if they are, you found your answer. If not, whichever of $x$ and $y$ are lower, increment that $n$ value (i.e., if $x < y$, then increment $n_x$). Recalculate $x$ and $y$ and repeat until they are the same.



      Here is an example implementation in Python using generators:



      class SpecialSquareGenerator:

      def __init__(self, n=0):
      self.n = n

      def __iter__(self):
      return self

      def __next__(self):
      self.n += 1
      return self.n, 2*(self.n**2)

      class SpecialFifthGenerator:

      def __init__(self, n=0):
      self.n = n

      def __iter__(self):
      return self

      def __next__(self):
      self.n += 1
      return self.n, 5*(self.n**5)

      def special_square():
      n = 0;
      ss = SpecialSquareGenerator()
      sf = SpecialFifthGenerator()
      nx, x = next(ss)
      ny, y = next(sf)
      print("{0}: {1}t{2}: {3}".format(nx, x, ny, y))
      while True:
      if (x == y): return x
      if x < y:
      nx, x = next(ss)
      else:
      ny, y = next(sf)
      print("{0}: {1}t{2}: {3}".format(nx, x, ny, y))

      if __name__ == "__main__":
      print(special_square())


      Running it returns the right answer:



      gns-mac1:sandbox gns$ python3 special_square.py 
      1: 2 1: 5
      2: 8 1: 5
      2: 8 2: 160
      3: 18 2: 160
      ...(output omitted)
      494: 488072 10: 500000
      495: 490050 10: 500000
      496: 492032 10: 500000
      497: 494018 10: 500000
      498: 496008 10: 500000
      499: 498002 10: 500000
      500: 500000 10: 500000
      500000


      Of course, the mathematical approach is better for understanding the problem. But if you need to guess and check, then computers are the tool for that.



      P.S.



      There is another way to exhaustively search for the solution. You can take sequential numbers and try dividing them by 2 (or 5) and then taking the square root (or fifth root) and then checking if that result is an integer for both operations. There are two downsides to this approach:




      • You have to decide if a floating point number is supposed to represent an integer. This is hard for computers and language implementations to do because computers only have a fixed set of digits to represent floating point numbers.

      • The search space is greater (by order of $n^2$). So that means that you should expect to take longer to reach the same answer, given the same hardware.


      P.S.S.



      There are faster ways to implement both my algorithm, and the other I mentioned in the postscript. For example, you can double $n$ each time and then when you overshoot, use binary search in the space between the last $n$ and the one that overshot.






      share|cite|improve this answer














      I am writing this answer because you said that you were trying a guess and check method. Computers are good at this. A decent algorithm is to have two integers $n_x$ and $n_y$ which start at 1. Then, calculate x by doing $2n_x^2$ and y by doing $5n_y^5$. Check if they are equal; if they are, you found your answer. If not, whichever of $x$ and $y$ are lower, increment that $n$ value (i.e., if $x < y$, then increment $n_x$). Recalculate $x$ and $y$ and repeat until they are the same.



      Here is an example implementation in Python using generators:



      class SpecialSquareGenerator:

      def __init__(self, n=0):
      self.n = n

      def __iter__(self):
      return self

      def __next__(self):
      self.n += 1
      return self.n, 2*(self.n**2)

      class SpecialFifthGenerator:

      def __init__(self, n=0):
      self.n = n

      def __iter__(self):
      return self

      def __next__(self):
      self.n += 1
      return self.n, 5*(self.n**5)

      def special_square():
      n = 0;
      ss = SpecialSquareGenerator()
      sf = SpecialFifthGenerator()
      nx, x = next(ss)
      ny, y = next(sf)
      print("{0}: {1}t{2}: {3}".format(nx, x, ny, y))
      while True:
      if (x == y): return x
      if x < y:
      nx, x = next(ss)
      else:
      ny, y = next(sf)
      print("{0}: {1}t{2}: {3}".format(nx, x, ny, y))

      if __name__ == "__main__":
      print(special_square())


      Running it returns the right answer:



      gns-mac1:sandbox gns$ python3 special_square.py 
      1: 2 1: 5
      2: 8 1: 5
      2: 8 2: 160
      3: 18 2: 160
      ...(output omitted)
      494: 488072 10: 500000
      495: 490050 10: 500000
      496: 492032 10: 500000
      497: 494018 10: 500000
      498: 496008 10: 500000
      499: 498002 10: 500000
      500: 500000 10: 500000
      500000


      Of course, the mathematical approach is better for understanding the problem. But if you need to guess and check, then computers are the tool for that.



      P.S.



      There is another way to exhaustively search for the solution. You can take sequential numbers and try dividing them by 2 (or 5) and then taking the square root (or fifth root) and then checking if that result is an integer for both operations. There are two downsides to this approach:




      • You have to decide if a floating point number is supposed to represent an integer. This is hard for computers and language implementations to do because computers only have a fixed set of digits to represent floating point numbers.

      • The search space is greater (by order of $n^2$). So that means that you should expect to take longer to reach the same answer, given the same hardware.


      P.S.S.



      There are faster ways to implement both my algorithm, and the other I mentioned in the postscript. For example, you can double $n$ each time and then when you overshoot, use binary search in the space between the last $n$ and the one that overshot.







      share|cite|improve this answer














      share|cite|improve this answer



      share|cite|improve this answer








      edited Oct 30 '18 at 2:28

























      answered Oct 29 '18 at 18:22









      Greg Schmit

      21017




      21017












      • Nice -- but as you hinted, it depends on whether (assuming this is a class) the teacher expects an analytic proof or not :-)
        – Carl Witthoft
        Oct 29 '18 at 19:03










      • @CarlWitthoft Yes, though because I'm a computer scientist I have to say that the student could prove that this program is guaranteed to provide the lowest integer that adheres to the constraints. It's actually similar to how they proved the 4 color theorem by using a computer program to iterate over a bunch of graphs. But you're probably right that the teacher wants them to use math, not computer programs. :)
        – Greg Schmit
        Oct 29 '18 at 19:45






      • 2




        @numbermaniac That's why I used the particular algorithm that I did, which doesn't require the computation of square roots or fifth roots and doesn't require any floating point math (to avoid rounding errors). It executes in 0.033s on a MBP in Python 3.6.
        – Greg Schmit
        Oct 30 '18 at 2:16






      • 1




        I bet it took substantially more than 8.7 seconds to write it though. Mathematica wins on this one!
        – Mike Spivey
        Oct 30 '18 at 9:45






      • 1




        Here's a Python two-liner as an alternative: import itertools; next(10*i for i in itertools.count(1) if round((5*i)**0.5)**2 == 5*i and round((2*i)**0.2)**5 == 2*i)
        – Eric Duminil
        Oct 30 '18 at 11:23


















      • Nice -- but as you hinted, it depends on whether (assuming this is a class) the teacher expects an analytic proof or not :-)
        – Carl Witthoft
        Oct 29 '18 at 19:03










      • @CarlWitthoft Yes, though because I'm a computer scientist I have to say that the student could prove that this program is guaranteed to provide the lowest integer that adheres to the constraints. It's actually similar to how they proved the 4 color theorem by using a computer program to iterate over a bunch of graphs. But you're probably right that the teacher wants them to use math, not computer programs. :)
        – Greg Schmit
        Oct 29 '18 at 19:45






      • 2




        @numbermaniac That's why I used the particular algorithm that I did, which doesn't require the computation of square roots or fifth roots and doesn't require any floating point math (to avoid rounding errors). It executes in 0.033s on a MBP in Python 3.6.
        – Greg Schmit
        Oct 30 '18 at 2:16






      • 1




        I bet it took substantially more than 8.7 seconds to write it though. Mathematica wins on this one!
        – Mike Spivey
        Oct 30 '18 at 9:45






      • 1




        Here's a Python two-liner as an alternative: import itertools; next(10*i for i in itertools.count(1) if round((5*i)**0.5)**2 == 5*i and round((2*i)**0.2)**5 == 2*i)
        – Eric Duminil
        Oct 30 '18 at 11:23
















      Nice -- but as you hinted, it depends on whether (assuming this is a class) the teacher expects an analytic proof or not :-)
      – Carl Witthoft
      Oct 29 '18 at 19:03




      Nice -- but as you hinted, it depends on whether (assuming this is a class) the teacher expects an analytic proof or not :-)
      – Carl Witthoft
      Oct 29 '18 at 19:03












      @CarlWitthoft Yes, though because I'm a computer scientist I have to say that the student could prove that this program is guaranteed to provide the lowest integer that adheres to the constraints. It's actually similar to how they proved the 4 color theorem by using a computer program to iterate over a bunch of graphs. But you're probably right that the teacher wants them to use math, not computer programs. :)
      – Greg Schmit
      Oct 29 '18 at 19:45




      @CarlWitthoft Yes, though because I'm a computer scientist I have to say that the student could prove that this program is guaranteed to provide the lowest integer that adheres to the constraints. It's actually similar to how they proved the 4 color theorem by using a computer program to iterate over a bunch of graphs. But you're probably right that the teacher wants them to use math, not computer programs. :)
      – Greg Schmit
      Oct 29 '18 at 19:45




      2




      2




      @numbermaniac That's why I used the particular algorithm that I did, which doesn't require the computation of square roots or fifth roots and doesn't require any floating point math (to avoid rounding errors). It executes in 0.033s on a MBP in Python 3.6.
      – Greg Schmit
      Oct 30 '18 at 2:16




      @numbermaniac That's why I used the particular algorithm that I did, which doesn't require the computation of square roots or fifth roots and doesn't require any floating point math (to avoid rounding errors). It executes in 0.033s on a MBP in Python 3.6.
      – Greg Schmit
      Oct 30 '18 at 2:16




      1




      1




      I bet it took substantially more than 8.7 seconds to write it though. Mathematica wins on this one!
      – Mike Spivey
      Oct 30 '18 at 9:45




      I bet it took substantially more than 8.7 seconds to write it though. Mathematica wins on this one!
      – Mike Spivey
      Oct 30 '18 at 9:45




      1




      1




      Here's a Python two-liner as an alternative: import itertools; next(10*i for i in itertools.count(1) if round((5*i)**0.5)**2 == 5*i and round((2*i)**0.2)**5 == 2*i)
      – Eric Duminil
      Oct 30 '18 at 11:23




      Here's a Python two-liner as an alternative: import itertools; next(10*i for i in itertools.count(1) if round((5*i)**0.5)**2 == 5*i and round((2*i)**0.2)**5 == 2*i)
      – Eric Duminil
      Oct 30 '18 at 11:23











      0














      Hint: Let the required number be x:



      $frac{1}{2}x= A^2$



      $frac{1}{5}x= B^5$



      $frac{1}{2}x+frac{1}{5}x =A^2+B^5$



      $frac{5x+2x}{10}=A^2+B^5$



      $7x=10(A^2+B^5)$



      $x=10k$; $k ∈ N $.



      So x is a power of 10.



      The smallest 5th power of 10 is $10^5$ so the number must be $5times 10^5=500000$.






      share|cite|improve this answer


























        0














        Hint: Let the required number be x:



        $frac{1}{2}x= A^2$



        $frac{1}{5}x= B^5$



        $frac{1}{2}x+frac{1}{5}x =A^2+B^5$



        $frac{5x+2x}{10}=A^2+B^5$



        $7x=10(A^2+B^5)$



        $x=10k$; $k ∈ N $.



        So x is a power of 10.



        The smallest 5th power of 10 is $10^5$ so the number must be $5times 10^5=500000$.






        share|cite|improve this answer
























          0












          0








          0






          Hint: Let the required number be x:



          $frac{1}{2}x= A^2$



          $frac{1}{5}x= B^5$



          $frac{1}{2}x+frac{1}{5}x =A^2+B^5$



          $frac{5x+2x}{10}=A^2+B^5$



          $7x=10(A^2+B^5)$



          $x=10k$; $k ∈ N $.



          So x is a power of 10.



          The smallest 5th power of 10 is $10^5$ so the number must be $5times 10^5=500000$.






          share|cite|improve this answer












          Hint: Let the required number be x:



          $frac{1}{2}x= A^2$



          $frac{1}{5}x= B^5$



          $frac{1}{2}x+frac{1}{5}x =A^2+B^5$



          $frac{5x+2x}{10}=A^2+B^5$



          $7x=10(A^2+B^5)$



          $x=10k$; $k ∈ N $.



          So x is a power of 10.



          The smallest 5th power of 10 is $10^5$ so the number must be $5times 10^5=500000$.







          share|cite|improve this answer












          share|cite|improve this answer



          share|cite|improve this answer










          answered Nov 4 '18 at 6:16









          user123

          526




          526























              0














              All integers of this kind can be written in the form,



              $$k = 5^{10a - 4} 2^{10b - 5} c^{10d}$$



              where $a, b, c, d in mathbb{Z}_{ge 1}$ (or $a, b, c, d$ are non-negative integers)





              Let's make sure this works.



              $$ k/5 = 5^{10a-5} 2^{10b-5} = (5^{2a-1} 2^{2b-1} c^{2d})^5$$



              So, $1/5$ of $k$ is a perfect fifth power.



              $$ k/2 = 5^{10a-4} 2^{10b-6} = (5^{5a-2} 2^{5b-3} c^{5d})^2$$



              So, $1/2$ of $k$ is a perfect square.





              The smallest integer of this kind is the one where $a, b, c, d = 1$ which is $k = 5^6 2^5 = 500000$.





              You can find all integers that follow your definition by using different values of $a, b, c, d$.






              share|cite|improve this answer


























                0














                All integers of this kind can be written in the form,



                $$k = 5^{10a - 4} 2^{10b - 5} c^{10d}$$



                where $a, b, c, d in mathbb{Z}_{ge 1}$ (or $a, b, c, d$ are non-negative integers)





                Let's make sure this works.



                $$ k/5 = 5^{10a-5} 2^{10b-5} = (5^{2a-1} 2^{2b-1} c^{2d})^5$$



                So, $1/5$ of $k$ is a perfect fifth power.



                $$ k/2 = 5^{10a-4} 2^{10b-6} = (5^{5a-2} 2^{5b-3} c^{5d})^2$$



                So, $1/2$ of $k$ is a perfect square.





                The smallest integer of this kind is the one where $a, b, c, d = 1$ which is $k = 5^6 2^5 = 500000$.





                You can find all integers that follow your definition by using different values of $a, b, c, d$.






                share|cite|improve this answer
























                  0












                  0








                  0






                  All integers of this kind can be written in the form,



                  $$k = 5^{10a - 4} 2^{10b - 5} c^{10d}$$



                  where $a, b, c, d in mathbb{Z}_{ge 1}$ (or $a, b, c, d$ are non-negative integers)





                  Let's make sure this works.



                  $$ k/5 = 5^{10a-5} 2^{10b-5} = (5^{2a-1} 2^{2b-1} c^{2d})^5$$



                  So, $1/5$ of $k$ is a perfect fifth power.



                  $$ k/2 = 5^{10a-4} 2^{10b-6} = (5^{5a-2} 2^{5b-3} c^{5d})^2$$



                  So, $1/2$ of $k$ is a perfect square.





                  The smallest integer of this kind is the one where $a, b, c, d = 1$ which is $k = 5^6 2^5 = 500000$.





                  You can find all integers that follow your definition by using different values of $a, b, c, d$.






                  share|cite|improve this answer












                  All integers of this kind can be written in the form,



                  $$k = 5^{10a - 4} 2^{10b - 5} c^{10d}$$



                  where $a, b, c, d in mathbb{Z}_{ge 1}$ (or $a, b, c, d$ are non-negative integers)





                  Let's make sure this works.



                  $$ k/5 = 5^{10a-5} 2^{10b-5} = (5^{2a-1} 2^{2b-1} c^{2d})^5$$



                  So, $1/5$ of $k$ is a perfect fifth power.



                  $$ k/2 = 5^{10a-4} 2^{10b-6} = (5^{5a-2} 2^{5b-3} c^{5d})^2$$



                  So, $1/2$ of $k$ is a perfect square.





                  The smallest integer of this kind is the one where $a, b, c, d = 1$ which is $k = 5^6 2^5 = 500000$.





                  You can find all integers that follow your definition by using different values of $a, b, c, d$.







                  share|cite|improve this answer












                  share|cite|improve this answer



                  share|cite|improve this answer










                  answered Nov 15 '18 at 23:33









                  XYZT

                  419320




                  419320






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Mathematics Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      Use MathJax to format equations. MathJax reference.


                      To learn more, see our tips on writing great answers.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2976181%2fwhat-is-the-smallest-integer-greater-than-1-such-that-frac12-of-it-is-a-perfe%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Ellipse (mathématiques)

                      Quarter-circle Tiles

                      Mont Emei