-
Notifications
You must be signed in to change notification settings - Fork 0
/
euler01.m
32 lines (26 loc) · 1.01 KB
/
euler01.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
% copyright 2009 Devin Kelly
%
% This is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 3, or (at your option)
% any later version.
%
% This software is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License along
% with this program; if not, write to the Free Software Foundation, Inc.,
% 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
function [s] = euler01() %#eml
limit = 10e6;
nums = zeros(limit,1);
k=0;
for k=1:limit-1
if ~mod(k,5) || ~mod(k,3)
nums(k)=k;
end
end
s = sum(nums);
end