Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
function result = isFactorionNumber(number)
result=0;
numberArray = num2str(number);
sum=0;
for i=1:1:length(numberArray)
sum=sum+factorial(str2num(numberArray(i)));
end
if isequal(number,sum)
result=1;
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment