+ 8
Challenge✋: Square and cube numbers
The point is to: - Find all the positive integers "n" from 1 to 10000, that fulfill the conditions: -- n/2 is a square number; -- n/6 is a cube number. Any language is welcomed.
10 Answers
+ 5
2.a.a = 3.2.b.b.b
then, a = (3.b.b.b)^(1/2).
and b will always be 3 times of a square number.
The possible values of b are 1,4,9,16,25,36,49.... multiplied by 3.
then print (3.2.b.b.b)
https://code.sololearn.com/cgfutI5ODorh/?ref=app
+ 3
@VcC Agree, but I wanted to see how do you confirm if an integer is a square or cube, thats all. For example I solved it this way:
https://code.sololearn.com/cYNFLOXiyjGf/?ref=app
+ 2
Yes, I get it...
Thanks for the explaination...
+ 2
https://code.sololearn.com/ctypCaHmkIxB/?ref=app
+ 1
Since 2.a^2 is divisible by 3 the number of factor 3 must be both 2u (because u is a factor of a) and also 1+3v because n=3*b^3 and >0 then u,v can only equal 2,1 others are too big next is 5,3 and 6.(3^3)^3>10000. n=2.9^2=6.3^3=162 works. And adding another factor would muktiply by at least p^6 (because this factor should be both cubed abd squared) which is too big because 162*2^6>10000
0
probably doable by hand using some algebra and writing n as a product of p^Fp and seeimg what Fp can be considered n=2.a^2=2.3.b^3
0
Well after doing the math you dont need any program. or print(162). :-)