% LMex040402_4th.m
% Larsen & Marx (2006) Introduction to Mathematical Statistics, 4th Edition
% Application of the geometric pdf and continuous geometric
% Written by Eugene.Gallagher@umb.edu
% Written 10/29/10, revised 1/9/11
% This general solution will solve for any number of letters.
% 100.2 trips required to get  26 letters
letters=6;
EX=zeros(letters,1);
EX(1)=1; % 1 trip to get one letter;
% Theorem 4.4.1: E(X)=1/p;
for i=1:letters
 EX(i)=letters/(letters-(i-1)); 
end
fprintf('%5.1f trips required to get %3.0f letters\n',sum(EX),letters)