Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

8. A Keith number is a number (integer) that appears in a Fibonac sequence that

ID: 3184726 • Letter: 8

Question

8. A Keith number is a number (integer) that appears in a Fibonac sequence that is based on its own decimal digits. For two-decimal digit num. bers (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 Fibo- nacci-like sequence is 1, 4, 5, 9, 14. Write a MATLAB program that deter mines and displays all the Keith numbers between 10 and 99

Explanation / Answer

The MATLAB program to find keith number is as follows:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
sto_z = zeros(1,2);
keith = [];
for i = 11:98
sto_z(1,2) = mod(i,10);
sto_z(1,1) = (i - sto_z(1,2))/10;
n = sum(sto_z);
while n<i
sto_z(1,1) = sto_z(1,2);
sto_z(1,2) = n ;
n = sum(sto_z);
end
if n == i
keith = [keith,n];
  
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

and the workspace result is

keith

keith =

14 19 28 47 61 75

Please, Like if yoou find it useful.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote