### shivamp_95's blog

By shivamp_95, history, 4 weeks ago, ,

recently there was a question to make program by solving the sequence-pattern given in input and output... please try to find it ,and help me if you can .... for every two integer input ,an output was given:

input
(1 4)
(2 3)
(4 10)
(7 10)
(8 100)
(200 300 )
(255 275)
output 5 5 12 7 1043 4048 1060

respectively how can input and output be related here, to each other????

edit : i would like to thank ChasmOfSarcasm for his message ,thanks for solving it .

• -13

 » 4 weeks ago, # |   0 Ain't nobody got time for that.
•  » » 4 weeks ago, # ^ |   +3 but you definitely got time to comment ... LOL .
 » 4 weeks ago, # |   0 I could not come up with a solution after looking at it , I am trying to think now but am tired.But, how do we know you are not just typing a random list of numbers and trolling us?
•  » » 4 weeks ago, # ^ |   0 Please provide link to the problem.
•  » » » 4 weeks ago, # ^ |   0 https://www.hackerearth.com/codearena/ring/14d2717/this is link of that problem ...
 » 4 weeks ago, # | ← Rev. 2 →   +7 Here's simple program which solves given task: #include #include usnig namespace std; int main() { int x, y; mt19937 rnd; while(cin >> x >> y) cout << rnd() % 5000 << endl; return 0; } 
•  » » 4 weeks ago, # ^ |   0 So what did you sacrifice to become master?
•  » » » 4 weeks ago, # ^ |   +9 5 stacks of yellow dye in Minecraft.
•  » » 4 weeks ago, # ^ |   0 this code is not working ?? i think i was unable to interpret problem correctly .. here is its linkhttps://www.hackerearth.com/codearena/ring/14d2717/
•  » » 4 weeks ago, # ^ |   0 bro ,your solution is wrong , i got the correct answer from ChasmOfSarcasm ... here output is the sum of prime numbers between input range [a b] ... thanks for trying it and giving your time for my question ...
•  » » » 4 weeks ago, # ^ |   +4 Did you even like, read the code?
•  » » » » 4 weeks ago, # ^ |   0 yes , he is using random values and taking its mod with 5000 ..., i too initially thought to do this as i was unable to build any connection between input and output . but it failed ....
•  » » » 4 weeks ago, # ^ |   0 can you please tell us how we can also learn to make such observation? I could not see it
 » 4 weeks ago, # |   0 You have to be more specific on what type of relationship you're looking for. Any set of input and output values can be fitted perfectly by some polynomial. For example, I could say that the output is (197121089224141 x^5)/14824459483725929637600 - (9060603386308189 x^4)/570171518604843447600 + (26660326915496837687 x^3)/4941486494575309879200 - (1422560370026178478451 x^2)/3706114870931482409400 + (4867386451591739811563 x)/741222974186296481880 - 3706498869439340167/196090733911718646 where x is the sum of the two inputs.
•  » » 4 weeks ago, # ^ |   0 How did you find this polynomial?
•  » » » 4 weeks ago, # ^ |   +13 It's evident BessieTheCow has spent a lot of time on AOPS.
•  » » » 4 weeks ago, # ^ | ← Rev. 3 →   0
•  » » » » 4 weeks ago, # ^ |   0 your link is not working
•  » » » » » 4 weeks ago, # ^ |   0 The markup parser seems to have trouble with parenthesis in links.
•  » » 4 weeks ago, # ^ |   0 so ,you mean ,you are trying to fit all given sample test in a polynomial equation , but then it will fail at system test .... if we do it without any logic ...
•  » » » 4 weeks ago, # ^ |   +3 That isn't supposed to be a solution to the problem. The point is that "find a relationship between a given set of inputs and outputs" isn't really a good question because there will always be many possible relationships that match any set of input and outputs if we don't restrict the type of relationship we're looking for.
•  » » » » 4 weeks ago, # ^ |   0 I got you bro , but here i got solution ( credit : ChasmOfSarcasm)..... output is sum of prime numbers between given input range [a b] .... btw ,developing a polynomial without knowing all test cases is extremely tough.we need to observe the repeated pattern ,after your response i tried to make graph between input a ,input b and output in 3-d but it was very hard to observe any pattern except if we don't know prime numbers are involve there . also it will form a non continuous discrete points plot.. there also main task will be to observe & interpret the pattern between a and b which result output in z axis.. it is very tough to know it ,without knowing value of function between a and b at various point. yes i fully agree with you, there may be some other possibility to solve it .i would love to know how you formed above equation and by what logic ,you decided its parameter ....
•  » » » » 4 weeks ago, # ^ | ← Rev. 2 →   0 i observed your link , now i got to know ,what you were saying ... thanks for it ,your logic is definitely correct. there are multiple answer to it .
 » 4 weeks ago, # | ← Rev. 2 →   0 This is the link of that problem https://www.hackerearth.com/codearena/ring/14d2717/i think i was unable to interpret problem correctly ,please have a look at it