+ 33

[ASSIGNMENT] LCM (X,Y) = W (lcm 4 least common multiple)

Your task is to find total number of possible ordered pairs (x,y) such that they satisfy condition : LCM(x,y) = W where x,y,W belongs to set of whole numbers Examples : For input : 3 //W=3 [(1,3),(3,3),(3,1)] => 3 possible ordered pairs such that LCM(x,y)=3 output : 3 input : 12 output : 15 👉ALREADY SUBMITTED AS AN ASSIGNMENT👈

3rd Mar 2018, 11:42 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
26 Answers
+ 3
This is another algorithm, in it the bust is reduced to a minimum. He handles such numbers as 54000000000 and factorial from 22. https://code.sololearn.com/c5crJIjCtv71/?ref=app
11th Mar 2018, 7:09 PM
Вадим Сухотин (Vadim Sukhotin)
Вадим Сухотин (Vadim Sukhotin) - avatar
+ 27
https://code.sololearn.com/c8ihT2i5X0ZI/?ref=app
4th Mar 2018, 9:51 AM
LukArToDo
LukArToDo - avatar
+ 15
u can make ur own post containing all the best ones & marking it best 😂😂😂😂 u might get xp too🤣🤣🤣
11th Mar 2018, 6:36 PM
🌛DT🌜
🌛DT🌜 - avatar
+ 14
nice suggestion @DT //it does not give any xp //looks like some1 made a cool code
11th Mar 2018, 7:30 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 13
sure @Vaibhav //U missed some possibilities like (12,3),(12 ,4), (12,6), (6,12), (3,12), (4,12), (2,12), (12,2), (6,4), (4,6)etc
4th Mar 2018, 7:23 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 13
//try 2 mine own challenge 😅 https://code.sololearn.com/cOhOt9cgecGJ/?ref=app
10th Mar 2018, 7:05 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 12
@Kazi , "lowest common multiple of x & y " is lowest number which comes in table of both x & y 👉now LCM(1,1) = 1 //as 1 is the lowest no. comes in table of both 1,1 //so 1 not equals to 12 ... hence soln rejected 👉LCM(2,3)=6 //as 6 is the lowest number which comes in table of both 2&3 similarily ... f (1,2)=2 , f (1,3)=3 ,f (1,4)=4,f (1,6)=6 //since these are not equal to 12 .... these are not cases to be counted //similarily , U can reject some more cases from the set of orders U given ... where f (x,y) is not coming out to be 12 //hope i explained well 😅 //assuming input is 12 & f (x,y) means LCM(x,y)
4th Mar 2018, 11:12 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 11
no option to mark more than 1 answer as best 😅 //any idea???
11th Mar 2018, 11:08 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 9
#Thanks Gaurav.. here's my solution. https://code.sololearn.com/cSBIIOc3VpM7/?ref=app
4th Mar 2018, 12:38 PM
Käzî Mrîdùl Høssäîn
Käzî Mrîdùl Høssäîn - avatar
+ 6
I want to point out that not all forms of access to SL enable the submission of an assignment. In this case, posts like this should be considered transitional until all platforms allow lesson submissions.
4th Mar 2018, 12:47 AM
SQrL
SQrL - avatar
+ 6
why it's not?when I entered 12? please explain...buddy.😊 [(1, 1), (1, 2), (1, 3), (1, 4), (1, 6), (1, 12), (2, 1), (2, 2), (2, 3), (2, 4), (2, 6), (2, 12), (3, 1), (3, 2), (3, 3), (3, 4), (3, 6), (3, 12), (4, 1), (4, 2), (4, 3), (4, 4), (4, 6), (4, 12), (6, 1), (6, 2), (6, 3), (6, 4), (6, 6), (6, 12), (12, 1), (12, 2), (12, 3), (12, 4), (12, 6), (12, 12)]
4th Mar 2018, 10:38 AM
Käzî Mrîdùl Høssäîn
Käzî Mrîdùl Høssäîn - avatar
+ 5
uffff... brute force... suboptimal.. sometimes ugly... what else can I say about my solution... IT WORKS!!! 💃💥🎉 https://code.sololearn.com/cO5OW5Rn7A6x/#java so now I'm finally free to look into other people's codes )))
4th Mar 2018, 11:01 PM
MARTA
MARTA - avatar
+ 4
Now, what is the LCM part please ETA: Ok, middle school was a long time ago and I didn’t make the connection between the acronym and the Least Common Multiple concept. Wow that was a while back.
4th Mar 2018, 12:48 AM
SQrL
SQrL - avatar
4th Mar 2018, 12:49 PM
Abhimanyu Gupta
Abhimanyu Gupta - avatar
5th Mar 2018, 8:58 PM
Paul
Paul - avatar
+ 4
https://code.sololearn.com/cK92JOabhWDB/?ref=app
6th Mar 2018, 11:13 AM
Arun
+ 2
use the assignment section and summit your challenge
4th Mar 2018, 12:01 AM
Nura Programmer
Nura Programmer - avatar
+ 2
hey guys, I think lukArToDo has passed this challenge, any other....
4th Mar 2018, 12:10 PM
Nura Programmer
Nura Programmer - avatar
6th Mar 2018, 9:42 PM
Вадим Сухотин (Vadim Sukhotin)
Вадим Сухотин (Vadim Sukhotin) - avatar
7th Mar 2018, 5:26 AM
Вадим Сухотин (Vadim Sukhotin)
Вадим Сухотин (Vadim Sukhotin) - avatar