# Problem 57535. Find patterns in subprime Fibonacci sequences

Lots of Cody problems involve Fibonacci and Collatz sequences. Fibonacci sequences start with two numbers, and later terms are computed by summing the previous two terms. The terms continue to increase, of course. Terms in Collatz sequences are computed with a different formula, and for the initial values that have been tried, the sequences eventually reach a 1. An unsolved problem is whether Collatz sequences reach 1 for any initial value.
The problem combines ideas from these two sequences by examining subprime Fibonacci sequences. The sequence starts with two given values, and the next term is computed as the sum of the previous two. However, if the sum is composite, it is divided by the smallest prime factor. If the starting values are [1 1], then the sequence is 1, 1, 2, 3, 5, 4, 3, 7, 5, etc.
Just as all Collatz sequences reach 1 (so far), all subprime Fibonacci sequences reach a repeating pattern. However, the pattern changes with the starting values. With starting values [1 1], the repeating pattern is 18 terms long, and it starts on term 38. With starting values [7 37], the repeating pattern is 136 terms long, and it starts on term 37. The subprime Fibonacci conjecture, from this paper, is that a repeating pattern is reached for all starting values.
Write a function that takes a vector of two starting values and produces the repeating pattern, the number of the starting term, and the length of the pattern. Can you find patterns of lengths other than those in the test suite? Can you prove the subprime Fibonacci conjecture?

### Solution Stats

100.0% Correct | 0.0% Incorrect
Last Solution submitted on Feb 04, 2023

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!