Repetition in a variable [number]

tedor's icon

Hello

I wonder whether someone could give me a tip where to investigate:

I have a changing number box. I would like to be able to see whether there is a pattern which repeats in a certain time.

for example:
I am thinking about to write 10 sec of data in a list (10 values: add the next number to the end of the list, and erase the last one).
If there is a repetition in the pattern, made up of 3 values for example, like:

...,0,1,5,7,7,8,9,1,5,7,...

[1,5,7]

give me a bang!

If anyone could give me a hint!
Thank you,
Krisztian

Bas van der Graaff's icon

Hmm, good question. I don't see a really easy solution for this. In the specific case of checking for a sequence of 3 within 10, you could check by hand (see patch below). But I couldn't quickly think up an ingenious solution; but at the rate of 1 number input per second you have a lot of time to check things...

Max Patch
Copy patch and select New From Clipboard in Max.

tedor's icon

hi Bas

this is Very Smart! thank you, I modified it a bit so it compares the last 3 values (see below):
thank you.

hi vanille béchamel
I am just having a look in the example!
thank you.

Krisztian

Max Patch
Copy patch and select New From Clipboard in Max.

Roman Thilenius's icon

thats almost the same thing i had to do once in order to find repetitions in a melody. if you break down the process into smaller tasks you will see that it only consists of easy steps. for example "write the last 3 numbers in a coll at every new number" and then "compare the running list of 3 numbers with those which are already in the coll".

nothing against vanille oracles, but you should always try algebra with some gates and buffers first.

tedor's icon

hello Roman Thilenius

as time is short, I will keep what I got now, but as coll has more options (might be faster as well) I will come back to it later.

thank you for all your help.
Krisztian

jvkr's icon

This version makes the searching a bit simpler.

_
johan

Max Patch
Copy patch and select New From Clipboard in Max.

tedor's icon

vanille béchamel

nice! is there a help file as well?

best
K