Problem 42839. Identify the sequence

  • Created by HH

Given a row vector, x, return 1 if it is an arithmetic series, or 2 if it is a geometric series. If it is neither, return 0.

Example 1:

x = 1:8

y = 1

Example 2:

x = 2^(1:8)

y = 2

Example 3:

x = [1 1 2 3 5 8 13 21 34]

y = 0

Solution Stats

31.25% Correct | 68.75% Incorrect
Last Solution submitted on Dec 30, 2025

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers29

Suggested Problems

More from this Author45

Problem Tags

Community Treasure Hunt

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

Start Hunting!