❗Challenge🤓 : Solve the Ramanujan Problem🎓 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 10

❗Challenge🤓 : Solve the Ramanujan Problem🎓

🌸You have to take a positive integer number as an input and find out number of ways, sum of it can be represented using positive integers. 🌸As example If input is 3 : way 1 > 1+1+1 way 2 > 2+1 way 3 > 1+2 🌸If input is 4 : way 1 > 1+1+1+1 way 2 > 1+1+2 way 3 > 1+2+1 way 4 > 1+3 way 5 > 2+1+1 way 6 > 2+2 way 7 > 3+1 🌸Great Ramanujan made equation for this problem and in that time no one was able to prove the equation. 🌸I bet they never knew any coding. But here you are.... Start Coding...!!🤓🤓

24th Jan 2018, 5:34 AM
Zoetic_Zeel
Zoetic_Zeel - avatar
32 Answers
+ 25
//haha ... this quesn comed in mind while doing something else so i thought to share what i thought , have a look at this (a+1)+(b+1)+ .... +(r+1) = n-r //a,b,c...r>=0 //(n-1)C(r-1) solutions ... 1st eqn nC0 +nC1 + nC2 + .... nCn = 2^n //take it as eqn... 2 for n to be expressed as sum of n,n-1,n-2 ... 2 terms //by using 1st eqn (n-1)C(1)+(n-1)C(2)+ ... (n-1)C (n-2)+(n-1)C(n-1) //using 2nd = 2^(n-1) - (n-1)C0 =2^(n-1) - 1
20th Feb 2018, 4:12 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
24th Jan 2018, 8:14 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 19
@zeel Patel //how u made that formula ????? //don't say by noticing the output for different inputs
24th Jan 2018, 3:40 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
24th Jan 2018, 7:49 AM
LukArToDo
LukArToDo - avatar
+ 10
my try https://code.sololearn.com/cLFU7vrOgsiV/?ref=app My thoughts with example 4: i have 4 stones lying in a row Between the stones i can put seperator. , max 3. i can choose 1,2 and 3 seperator at places 1 2 and three. eg stone x stone stone x stone -> 1 2 1 3 opps for one stone 3 opps for two stones one opp for three stones btw: with 4 is allowed... zero stones one opp 1331 which is the third row of pascal triangle Thanks for that challenge!
25th Jan 2018, 8:22 AM
Oma Falk
Oma Falk - avatar
+ 6
these types of problem can be proved by PMI //I personally hate this(not formula but Pmi) //I don't consider it as mathematics //btw ramanujan is my favorite and is the best!!!!
24th Jan 2018, 5:36 PM
Saurabh Tiwari
Saurabh Tiwari - avatar
+ 6
@zeel in mathematic the biggest fool can ask questiones, that cant be answered by the most genious mathematican. quote free remembered
25th Jan 2018, 8:47 AM
Oma Falk
Oma Falk - avatar
+ 6
The easiest answer for only counting the possibillities for a given number n: add all items of the (n-1)th row of Pascal Triangle. Somehow finally everything in math is sin, cos or Pascal :-))
25th Jan 2018, 11:02 AM
Oma Falk
Oma Falk - avatar
+ 5
At last Sayan bro wanna say that if we know question, if we know answer too, it is easier to solve the question..😁😉😉😀😀👍
24th Jan 2018, 5:42 PM
Zoetic_Zeel
Zoetic_Zeel - avatar
+ 5
yes it's just 2^n-1 The 1 come from the number itself, an invalid way.
21st Feb 2018, 2:32 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 3
works for large n. here with 20. https://code.sololearn.com/cN0n8eiMAkK9/?ref=app
24th Jan 2018, 6:44 AM
VcC
VcC - avatar
24th Jan 2018, 10:57 AM
Zoetic_Zeel
Zoetic_Zeel - avatar
+ 3
But I believe that there must be some well-established mathematical long enough to satisfy us proof for this question hidden somewhere in Google, wanna get the gold..? dig then..😉😉😊
24th Jan 2018, 5:46 PM
Zoetic_Zeel
Zoetic_Zeel - avatar
+ 2
My try is here, now your turn guys..!! https://code.sololearn.com/cMeA5EI16ROL/?ref=app
24th Jan 2018, 6:20 AM
Zoetic_Zeel
Zoetic_Zeel - avatar
+ 2
@Gaurav Agrawal Yes, Sayan is right, but I didn't knew formula when I posted this question. After people answered question, I found it interesting and googled about it, then I came to know it was such simple formula, it really surprised me that such complicated thing can have such simple formula..!... That's why Maths is Magic..😀😀
24th Jan 2018, 5:14 PM
Zoetic_Zeel
Zoetic_Zeel - avatar
+ 2
@Gaurav Agrawal Same has happened to me bro. I will not say wasted but struggled my whole morning finding the relationship between input and output but it is not the failure, when we try to solve some riddle, our mind gets exercise, so in one or another way time can be called utilized.
24th Jan 2018, 5:22 PM
Zoetic_Zeel
Zoetic_Zeel - avatar
+ 2
ok...let me give u my theory... @ Gaurav see...suppose the num is 5... the ans will be the total number pf numbers from (5+1) to 11111 that have digits summing up to 5... 14 23 32 41 113 122 131 212 221 311 1112 1121 1211 2111 11111......total 15(all sum up to 5) easy to find with a code ... ans=0 for i in range (5+1) to 11111 if sumdigit(i)==5 : ans+=1
24th Jan 2018, 6:05 PM
sayan chandra
sayan chandra - avatar
+ 2
sayan is back but with english multiliners
24th Jan 2018, 7:18 PM
VcC
VcC - avatar
+ 2
@saurabh why PMI is bad
26th Jan 2018, 2:03 PM
Mrityunjay Jha
Mrityunjay Jha - avatar
+ 1
the proof is easy nothing but a trial and deduction... 1---0 2---1 3---3 4---7 5---15 ......... n---2^(n-1)-1.. @Gaurav...1 shdn't give 1... as in any other number n...we r nt considering.. n=n... else 4 shd give 8... but thats nt the case... as 4---7 so 1 shd give 0
24th Jan 2018, 5:28 PM
sayan chandra
sayan chandra - avatar