% Huan Mei Chen
% 502-772-876
% David Sum
% 202-779-266
% cs170a
% Hw 3


% Problem 1

% define function to calculate probability that the given data is fraudulent
function prob(a)

t = sum(a);
len = length(a);
v = 0;
for i = 1:len,
    d = t*log10(1+1/i);
    v = v+((a(i)-d)^2/d);
end

prob = chisquared_prob(v,len-1)


