Matlab please Keith number is a number (integer) that appears in a Fibonacci-lik
ID: 3808828 • Letter: M
Question
Matlab please Keith number is a number (integer) that appears in a Fibonacci-like sequence that is based on its own decimal digits. For two-decimal digit numbers (10 through 99) a Fibonacci-like sequence is created in which the first element is the tens digit and the second element is the units digit. The value of each subsequent element is the sum of the previous two elements. If the number is a Keith number, then it appears in the sequence. For example, the first two-decimal digit Keith number is 14, since the corresponding Fibonacci-like sequence is 1, 4, 5, 9, 14. Write a MATLAB program that determines and displays all the Keith numbers between 10 and 99.Explanation / Answer
13)
f(1) = 1; %initialising first value as 1
f(2) = 4; % initialising 2 nd value as 4
i = 2; %declaring a variable
disp('The keith numbering sequence is:')
while f(i) < 100 %while loop to calculate fibonacci sequence up to 100
f(i+1) = f(i) + f(i-1); %calculating next value by summing first two elements
if f(i+1) > 9 % checking the value to pring if and only if the value is of double digit
disp(f(i+1))
end
i = i + 1; % incrementing i value ahich is index of next element in fibonacci series
end
Note: sample answer you have given in question is wrong if it follows fibonacci sequence
sample output is
The keith numbering sequence is:
14 23 37 60 97