+ 8

A coding challenge using exponents

One fine day, I was calculating the value of 5 and 8 cubed, which came out to be 125 and 512 respectively. As you can see, 1) The last digit shifted to the first or vice-versa 2) The last half of the number shifted to the first or vice-versa. I made a program on this, but this ended at a limit. My question is: Is there any pair like this which goes beyond the limit? Now, let me rephrase the thing you need to do. Write a program, iterate nos., calculate the cube and square of those nos., take the last (half/digit, digit preferred) and put it in the first (or take the first half/digit and put it in the last), and if the new no. is a perfect square or cube root, then print the pair. How many pairs do you get? (For languages supporting high value, is the limit being surpassed at some point of time?) Example output for loop variable i = 5 -- 5 = 125, 8 = 512

11th Dec 2022, 11:22 AM
GiantJupiter
GiantJupiter - avatar
6 Antworten
+ 5
https://code.sololearn.com/c6vU50RqxVVw/?ref=app
12th Dec 2022, 11:34 AM
Oma Falk
Oma Falk - avatar
+ 4
There are much more square than cube pairs: https://code.sololearn.com/cDLX0mQO1965/?ref=app
12th Dec 2022, 7:16 PM
Denise Roßberg
Denise Roßberg - avatar
+ 2
Found only two pairs of cubes with the base less than a million https://code.sololearn.com/cqekWyQEXkDh/?ref=app
13th Dec 2022, 6:58 AM
michal
+ 1
https://code.sololearn.com/c412byIbOtdw/?ref=app
17th Dec 2022, 7:00 PM
A͢J
A͢J - avatar