a program that finds the pattern between a string of numbers ?! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 7

a program that finds the pattern between a string of numbers ?!

For example input 1 ,3,5 Out put the next number is 7 I dont know how ?!

22nd May 2020, 12:49 AM
Jason
Jason - avatar
34 Answers
+ 3
If you have some random numbers 1,3,6,9,13,24 it's actually impossible , but if there is something like 1,3,6,10,15,21 and subtracting the next element from previous one(like 3-1) results in incrementing of the difference by 1 for a certain number of times ,then yup you found a pattern ,it could be many logics you can apply like is it increasing by 2,3 or if multiplying two numbers ouputs something that you know would make a pattern,o r any other logics,but you need as I said some pattern as a input that you can apply and test out , otherwise randomly looking for some pattern when you don't have a clue what you want to find in it seems impossible to me atleast,just what I think Maybe there are some pattern finding algorithms that I don't know about !
22nd May 2020, 1:08 AM
Abhay
Abhay - avatar
+ 9
🤗
22nd May 2020, 7:25 AM
narayanaprasad
narayanaprasad - avatar
+ 7
in 1,3,5 sequence see the difference between the numbers: between 1&3 difference is 2, between 3 & 5 difference is 2. Hence the next number should be 7, to maintain the difference to be 2. pattern will therefore be 1,3,5,7,9,11,13......so on so forth.
22nd May 2020, 7:06 AM
narayanaprasad
narayanaprasad - avatar
+ 6
Python program to find above(👆) pattern/ other patterns
22nd May 2020, 7:09 AM
narayanaprasad
narayanaprasad - avatar
+ 3
It won't automatically find some pattern until you design one so ,what I mean is there should be some pattern ,then based on that you can output next number ,
22nd May 2020, 12:52 AM
Abhay
Abhay - avatar
+ 3
Because you know the pattern but if you can find a pattern for all string of number its amazing 😉
22nd May 2020, 2:15 AM
Jason
Jason - avatar
+ 3
Well, I didn't know how to model. I still didn't get the answer. My main problem is my algorithm.
22nd May 2020, 2:22 AM
Jason
Jason - avatar
+ 3
Thanks
22nd May 2020, 6:28 PM
Jason
Jason - avatar
+ 3
If i want to write an ai and train it for this can any one helpme?!
22nd May 2020, 6:31 PM
Jason
Jason - avatar
+ 2
I want to find the pattern 😁 You say its impossible?!
22nd May 2020, 12:53 AM
Jason
Jason - avatar
+ 2
Does this require artificial intelligence? I don't know how I can figure out what the pattern is between numbers ?!
22nd May 2020, 1:00 AM
Jason
Jason - avatar
+ 2
If this is not required what can i do to can find the pattern between number?!
22nd May 2020, 1:06 AM
Jason
Jason - avatar
+ 2
Maybe it's better to ask a math question Is there a pattern between each string of numbers?
22nd May 2020, 1:16 AM
Jason
Jason - avatar
+ 2
Is it possible at all to create a program or algorithm that finds a pattern between each string of numbers when rendered?
22nd May 2020, 1:19 AM
Jason
Jason - avatar
+ 2
The next problem is that a unique pattern cannot be found for a series of numbers, meaning there may be more than one pattern for a string of numbers!
22nd May 2020, 1:26 AM
Jason
Jason - avatar
+ 2
Can you explain more?!
22nd May 2020, 1:52 AM
Jason
Jason - avatar
+ 2
Oh yeah But this is very different from what I want. I want to be able to find a relationship between them. For example 1,166,3 And my program find the next number 😁
22nd May 2020, 2:00 AM
Jason
Jason - avatar
+ 2
The number of possible "patterns" is very limited, why don't you just test them, store which dependencies you found and calculate the next element based on this information? Where's the problem?
22nd May 2020, 2:22 AM
Sandra Meyer
Sandra Meyer - avatar
+ 2
This was a community challenge a while back. There you will find some nice examples. https://www.sololearn.com/learn/4877/?ref=app
23rd May 2020, 8:49 AM
Louis
Louis - avatar
+ 2
Its wonderful But These programs use a fixed pattern and match the numbers with it, but I'm looking to find a pattern.
23rd May 2020, 11:07 AM
Jason
Jason - avatar