One type of self referential number is one in which each digit represents the number of occurrences of that digit in the number itself. For exmaple 21200 has 2 zeros, 1 one, 2 twos, 0 threes, and 0 fours.
The atbash substitution cipher has the reversed alphabet as the encoding rule: A means Z, B means Y, C means X, etc. For decimal digits, the atbash equivalent is simply 9 minus the digit.
Find a 10 digit atbash self referential number such that the leftmost digit is 9 minus the number of zeros, the next digit is 9 minus the number of ones, etc.
Try all possible counts of digits adding to 10.
Form the descriptive number for each.
Check that number to see if it has the given stats.
clc,clearvars
breaks=combinator(19,9,'c');
for i=1:length(breaks)
bounds=[0,breaks(i,:),20];
n=''; counts=[];
for j=0:9
counts(j+1)=bounds(j+2)-bounds(j+1)-1;
n=[n num2str(9-counts(j+1))];
end
good=true;
for j=0:9
counts2(j+1)=length(strfind(n,num2str(j)));
if counts2(j+1)~= counts(j+1)
good=false;
end
end
if good==true
disp(counts)
disp(n)
disp(counts2)
disp(' ')
end
if good
disp(n)
end
end
checks every possible set of statistics for 10 digits and finds one set that meets the criterion of self reference:
count of each digit:
digit 0 1 2 3 4 5 6 7 8 9
count 0 0 0 1 0 0 0 1 2 6
This would be encoded as 9998999873.
Doing the stats on this number we do get the given stats:
0 0 0 1 0 0 0 1 2 6
The answer is 9998999873.
|
Posted by Charlie
on 2024-02-27 08:33:36 |