From b63ca10669b378cd5967b522da355da27e56c367 Mon Sep 17 00:00:00 2001 From: Matthew Ellison Date: Wed, 26 Sep 2018 11:08:09 -0400 Subject: [PATCH] Added the 7th problem --- ProjectEuler/Problem7.m | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 ProjectEuler/Problem7.m diff --git a/ProjectEuler/Problem7.m b/ProjectEuler/Problem7.m new file mode 100644 index 0000000..2bd16b5 --- /dev/null +++ b/ProjectEuler/Problem7.m @@ -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;