Simple python question about sequence

soulblader_86

Supremacy Member
Joined
Sep 28, 2007
Messages
9,012
Reaction score
0
let say I enter a 4 digit in a certain sequence

how to make python detect the sequence and pattern my 4 digit is arrange and auto generate the next 3 digit?

1, 2, 4, 7, 11, ??, ??, ??, … # step = 1 -> 2 -> 3 -> 4 -> …
1, 3, 7, 13, 21, ??, ??, ??, … # step = 2 -> 4 -> 6 -> 8 -> …

for example

input 1st integer: 1
input 2nd integer: 3
input 3rd integer: 6
input 4th integer: 10

This a gradually increasing sequence

15
21
28
 

davidktw

Arch-Supremacy Member
Joined
Apr 15, 2010
Messages
13,550
Reaction score
1,302
let say I enter a 4 digit in a certain sequence

how to make python detect the sequence and pattern my 4 digit is arrange and auto generate the next 3 digit?

1, 2, 4, 7, 11, ??, ??, ??, … # step = 1 -> 2 -> 3 -> 4 -> …
1, 3, 7, 13, 21, ??, ??, ??, … # step = 2 -> 4 -> 6 -> 8 -> …

for example

Your question seems to be too rather open-ended. If I give you the following sequence "5, 8, 13, 21", would you be able to easily tell it's a Fibonacci sequence ?

How about the following ? "15485863, 32452843, 49979687, 67867967', it might take a computer a very long time to figure that out. So what are your constraint to your question. You will need to bound it.
 
Important Forum Advisory Note
This forum is moderated by volunteer moderators who will react only to members' feedback on posts. Moderators are not employees or representatives of HWZ Forums. Forum members and moderators are responsible for their own posts. Please refer to our Community Guidelines and Standards and Terms and Conditions for more information.
Top