+ 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.

1st Jan 2018, 3:59 PM
Ledio Deda
Ledio Deda - avatar
10 Respostas
+ 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
2nd Jan 2018, 7:02 AM
Viraj Singh
Viraj Singh - avatar
+ 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
1st Jan 2018, 4:47 PM
Ledio Deda
Ledio Deda - avatar
+ 2
Yes, I get it... Thanks for the explaination...
1st Jan 2018, 5:04 PM
Ledio Deda
Ledio Deda - avatar
2nd Jan 2018, 12:21 PM
Tuấn Kiệt Trần
Tuấn Kiệt Trần - avatar
+ 2
https://code.sololearn.com/ctypCaHmkIxB/?ref=app
15th Jan 2018, 7:28 PM
...
+ 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
1st Jan 2018, 5:00 PM
VcC
VcC - avatar
18th Jan 2018, 2:08 AM
Denise Roßberg
Denise Roßberg - avatar
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
1st Jan 2018, 4:43 PM
VcC
VcC - avatar
0
Well after doing the math you dont need any program. or print(162). :-)
2nd Jan 2018, 1:18 PM
VcC
VcC - avatar