mirror of
https://bitbucket.org/Mattrixwv/octavefunctions.git
synced 2026-02-04 04:02:32 -05:00
Added the 7th problem
This commit is contained in:
19
ProjectEuler/Problem7.m
Normal file
19
ProjectEuler/Problem7.m
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
%ProjectEuler/Problem7.m
|
||||||
|
%This is a script to answer Problem 7 for Project Euler
|
||||||
|
%What is the 10001th prime number?
|
||||||
|
|
||||||
|
%Setup the variables
|
||||||
|
counter = 1000;
|
||||||
|
primeList = [];
|
||||||
|
while(size(primeList)(2) < 10001)
|
||||||
|
primeList = primes(counter);
|
||||||
|
counter += 1000;
|
||||||
|
end
|
||||||
|
|
||||||
|
%Print the number
|
||||||
|
primeList(10001)
|
||||||
|
|
||||||
|
%Cleanup the variables
|
||||||
|
clear ans;
|
||||||
|
clear counter;
|
||||||
|
clear primeList;
|
||||||
Reference in New Issue
Block a user