Let me introduce you to a set of integers I’ve fiddled around recently.
I’ll call them
fibbons.
A fibbon is a number such that each of its digits, starting from the 3rd from the left, is a sum of 2 preceding digits e.g. 123, 3257, ..... etc
To get more profound knowledge of fibbons please fulfill the following tasks:
1. Show that the maximal length of a fibbon is 8 digits.
2. List all existing fibbons.
3. Specify the least frequent digit in your list.
4. Specify the most frequent digit in your list.
5. Denoting by f(k) the number of fibbons containing k digits, list the values for f(1), f(2), ...f(8)
6. Explain briefly how the list of 2 was generated.
clc
overtot=0; dCt=zeros(1,10); lCt=zeros(1,10);
for a=1:9
inittot=0;
n0=num2str(a);
for b=0:9
n=[n0 num2str(b)];
x=a; y=b;
while x+y<10
z=x+y;
n=[n num2str(z)];
overtot=overtot+1;
inittot=inittot+1;
disp(n)
for i=1:length(n)
s=str2num(n(i))+1;
dCt(s)=dCt(s)+1;
end
l=length(n);
lCt(l)=lCt(l)+1;
x=y; y=z;
end
end
disp(inittot)
end
disp(overtot)
disp(dCt)
disp(lCt)
The list assumes that a fibbon must have a 3rd digit, so 2-digit fibbons are not allowed. The numbers after each section are the number that begin with a particular digit.
101
1011
10112
101123
1011235
10112358
112
1123
11235
112358
123
1235
12358
134
1347
145
1459
156
167
178
189
21
202
2022
20224
202246
213
2134
21347
224
2246
235
2358
246
257
268
279
15
303
3033
30336
303369
314
3145
31459
325
3257
336
3369
347
358
369
14
404
4044
40448
415
4156
426
4268
437
448
459
10
505
5055
516
5167
527
5279
538
549
8
606
6066
617
6178
628
639
6
707
7077
718
7189
729
5
808
8088
819
3
909
9099
2
84
27 51 43 42 32 31 25 22 22 19
0 0 45 25 8 4 1 1 0 0
>>
1. 10112358 is the longest, with 8 digits.
2. List is above, with 84 members.
3. The least frequent digit is 9 at 19 occurrences.
4. The most frequent digit is 1 with 51 occurrences.
5. f(k) for k= 1 through 8 are:
0 0 45 25 8 4 1 1
6. For each first digit 1-9 and second digit 0-9 pair (9*10/2=45 such pairs), the formation rule was followed and each step of the way until a sum larger than 9 was formed, the step result was shown.
|
Posted by Charlie
on 2021-03-16 10:58:20 |