Problem 3010. Self-similarity 1 - Every other term
Self-similar integer sequences are certain sequences that can be reproduced by extracting a portion of the existing sequence. See the OEIS page for more information.
In this problem, you are to check if the sequence is self-similar by every other term. The problem set assumes that you use the easiest route: take the first element and then every other element thereafter of the original sequence, and compare that result to the first half of the original sequence. The function should return true if the extracted sequence is equal to the first half of the original sequence.
For example,
- seq_original_set = [0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4]
- seq_every_other = [0, , 1, , 1, , 2, , 1, , 2, , 2, , 3, ,] (extra commas are instructional and should not be in the every-other series)
- seq_orig_first_half = [0, 1, 1, 2, 1, 2, 2, 3]
Since seq_every_other = seq_orig_first_half, the set is self-similar.
This problem is related to Problem 3011 and Problem 3012.
Solution Stats
Problem Comments
-
2 Comments
what do u mean by every other element?
Asif, it means an index like: 1,0,1,0,1,0,1,0 ...
Solution Comments
Show commentsProblem Recent Solvers59
Suggested Problems
-
Extract leading non-zero digit
2135 Solvers
-
Get the area codes from a list of phone numbers
1054 Solvers
-
374 Solvers
-
Approximation of Pi (vector inputs)
220 Solvers
-
9158 Solvers
More from this Author139
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!