Find numbers in the Popular Computing Z-sequence - MATLAB Cody - MATLAB Central

Problem 52283. Find numbers in the Popular Computing Z-sequence

Difficulty:Rate
Here’s a quick one. In 1977 the magazine Popular Computing sought “problem situations for which the computer is the best (if not the only) tool for solution” and proposed the Z-sequence as a candidate “problem situation:”
a1 = a2 = 1 and a_n = |2 a_{n-2} + a_{n-1} – n| for n > 2
Among the Z-sequence’s properties, the magazine staff pointed out that “successive values seem unpredictable; that is, the values jump around, but not too wildly” and “almost every integer appears as a term in the sequence sooner or later, except for a few numbers, such as 245, 449, 569, 575, and 903.”
Write a function to find the index of the first occurrence of k (including the five numbers above) in the Popular Computing Z-sequence.

Solution Stats

73.91% Correct | 26.09% Incorrect
Last Solution submitted on Nov 10, 2024

Problem Comments

Solution Comments

Show comments
PIVlab surpasses 100K all-time File Exchange downloads
During the past twelve months, PIVlab, a MATLAB Community Toolbox for particle...
4
8
LLMs with MATLAB updated to support the latest OpenAI Models
Large Languge model with MATLAB, a free add-on that lets you access...
2
4

Problem Recent Solvers14

Suggested Problems

More from this Author298

Problem Tags

Community Treasure Hunt

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

Start Hunting!