+ 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
+ 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
24th Jan 2018, 8:14 AM
Gaurav Agrawal
+ 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
+ 17
24th Jan 2018, 7:49 AM
LukArToDo
+ 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
+ 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
+ 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
+ 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
+ 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
+ 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 πΈπ¬
+ 3
works for large n. here with 20. https://code.sololearn.com/cN0n8eiMAkK9/?ref=app
24th Jan 2018, 6:44 AM
VcC
+ 3
24th Jan 2018, 10:57 AM
Zoetic_Zeel
+ 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
+ 2
My try is here, now your turn guys..!! https://code.sololearn.com/cMeA5EI16ROL/?ref=app
24th Jan 2018, 6:20 AM
Zoetic_Zeel
+ 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
+ 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
+ 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
+ 2
sayan is back but with english multiliners
24th Jan 2018, 7:18 PM
VcC
+ 2