From 34f646ef05dd0efd38fc66892652453faaf39c89 Mon Sep 17 00:00:00 2001
From: CLARKBENHAM <33760513+CLARKBENHAM@users.noreply.github.com>
Date: Tue, 10 Apr 2018 01:07:02 -0400
Subject: [PATCH 1/4] Add files via upload
---
...Challenge_Clark_Benham Leiningen VM.launch | 21 ++++++++++++++++++
history.index | Bin 0 -> 1248 bytes
2 files changed, 21 insertions(+)
create mode 100644 RoomKey_CodingChallenge_Clark_Benham Leiningen VM.launch
create mode 100644 history.index
diff --git a/RoomKey_CodingChallenge_Clark_Benham Leiningen VM.launch b/RoomKey_CodingChallenge_Clark_Benham Leiningen VM.launch
new file mode 100644
index 0000000..5605863
--- /dev/null
+++ b/RoomKey_CodingChallenge_Clark_Benham Leiningen VM.launch
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/history.index b/history.index
new file mode 100644
index 0000000000000000000000000000000000000000..3522e00e7812584b3def9808a5b87385fca56cef
GIT binary patch
literal 1248
zcmYk&Ye-XJ9LMpq6^2GI3}lejAenZVn-?lIYM^3Z;96lgjGgW5;AZ9yW|(HS)Fz~m
z8e-W63Cb+SJVp5LNP|j&*S2Br?{fB!<?l}LQ^`7~A=$jr_lS_PqI}LV1QkhT2o+w7|33gM@N1D>nD@Loxbv1G&
z`knPF>33xq`l#U|`M{!4n*uw>w=X~4_#a(XX>AO6
zZPg;VLfe*!-mG3AHv~tFXrR9w{)6@NQW?7K)*QJMWU!+bOS5bzOO=dXxjIA6tAuFu
z`s@ICU9YKVKithe!rVI%C!t^a>1TcXR{^~%)<^DIv1ROqow)8V%=6mj_JCIzyyUu)
zfm-w&-v~LM`6u+wf~zSN+uKzFE_{|ChGp`!o*
literal 0
HcmV?d00001
From 783cab5848b6f551384c8815990cea081b61f412 Mon Sep 17 00:00:00 2001
From: CLARKBENHAM <33760513+CLARKBENHAM@users.noreply.github.com>
Date: Tue, 10 Apr 2018 01:13:08 -0400
Subject: [PATCH 2/4] Delete RoomKey_CodingChallenge_Clark_Benham Leiningen
VM.launch
---
...Challenge_Clark_Benham Leiningen VM.launch | 21 -------------------
1 file changed, 21 deletions(-)
delete mode 100644 RoomKey_CodingChallenge_Clark_Benham Leiningen VM.launch
diff --git a/RoomKey_CodingChallenge_Clark_Benham Leiningen VM.launch b/RoomKey_CodingChallenge_Clark_Benham Leiningen VM.launch
deleted file mode 100644
index 5605863..0000000
--- a/RoomKey_CodingChallenge_Clark_Benham Leiningen VM.launch
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
From 8954cc2c0272b767a8344299891fd776d06de9b2 Mon Sep 17 00:00:00 2001
From: CLARKBENHAM <33760513+CLARKBENHAM@users.noreply.github.com>
Date: Tue, 10 Apr 2018 01:13:18 -0400
Subject: [PATCH 3/4] Delete history.index
---
history.index | Bin 1248 -> 0 bytes
1 file changed, 0 insertions(+), 0 deletions(-)
delete mode 100644 history.index
diff --git a/history.index b/history.index
deleted file mode 100644
index 3522e00e7812584b3def9808a5b87385fca56cef..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 1248
zcmYk&Ye-XJ9LMpq6^2GI3}lejAenZVn-?lIYM^3Z;96lgjGgW5;AZ9yW|(HS)Fz~m
z8e-W63Cb+SJVp5LNP|j&*S2Br?{fB!<?l}LQ^`7~A=$jr_lS_PqI}LV1QkhT2o+w7|33gM@N1D>nD@Loxbv1G&
z`knPF>33xq`l#U|`M{!4n*uw>w=X~4_#a(XX>AO6
zZPg;VLfe*!-mG3AHv~tFXrR9w{)6@NQW?7K)*QJMWU!+bOS5bzOO=dXxjIA6tAuFu
z`s@ICU9YKVKithe!rVI%C!t^a>1TcXR{^~%)<^DIv1ROqow)8V%=6mj_JCIzyyUu)
zfm-w&-v~LM`6u+wf~zSN+uKzFE_{|ChGp`!o*
From 3f06058fec30421f0ec44ae2cddb3baa4a39210e Mon Sep 17 00:00:00 2001
From: CLARKBENHAM <33760513+CLARKBENHAM@users.noreply.github.com>
Date: Tue, 10 Apr 2018 01:19:32 -0400
Subject: [PATCH 4/4] Add files via upload
Clojure code for the number 7 project Euler puzzle.
---
CodingChallenge_Roomkey_Clark_Benham.clj | 47 ++++++++++++++++++++++++
1 file changed, 47 insertions(+)
create mode 100644 CodingChallenge_Roomkey_Clark_Benham.clj
diff --git a/CodingChallenge_Roomkey_Clark_Benham.clj b/CodingChallenge_Roomkey_Clark_Benham.clj
new file mode 100644
index 0000000..f295983
--- /dev/null
+++ b/CodingChallenge_Roomkey_Clark_Benham.clj
@@ -0,0 +1,47 @@
+(ns room-key-coding-challenge.core)
+
+(def n 10001); the number prime which will be found
+
+(defn is-not-prime [number & [factors]]
+ (boolean (some integer? (map #(/ number %) factors))));;tests if a number is not a prime, based on a vector of all potential prime factors
+
+(defn upper-bound [k] (Math/ceil (* k (+ (Math/log k) (Math/log (Math/log k)) -1 (* 1.8 (Math/log (Math/log k)) (/ (Math/log k) )))))) ;;k*(ln(k)+ln(ln(k)-1+1.8*ln(ln(k))/ln(k))) formula for the maximium value of the Kth prime for k>13
+(def upper-value (int (upper-bound n)));;finds the maximium possible integer value of the nth prime
+
+(def biggest-factor (Math/ceil (Math/sqrt upper-value)));;to test if the prime, see if division with a diffrent number will produce an integer, sqrt(number) is the biggest possible factor; sqrt(n)*sqrt(n)=n
+(def num-factors (Math/ceil (/ (- biggest-factor 5) 2)));;subtracting values as the first 5 primes are given; testing increments by 2 so needs half as many steps
+
+
+(def factors (reduce (fn [primes number]
+ (if (is-not-prime number primes)
+ primes
+ (conj primes number)));;if a number is a primes it is appended to the vector of primes; this is where vector of potential factors is created
+ [2 3 5 7 11](take num-factors (iterate (partial + 2) 13))));;starts at 13 as the lower bound estimation for prime numbers is true for n>13; incrementing by 2 as no even number will be prime
+
+
+;;function returns the nth prime from a starting odd number, given the vector of all possible prime factors
+(defn nth-prime [start-prime prime-factors count]
+ (loop [search start-prime
+ prime-factors prime-factors
+ count count]
+ (if (is-not-prime search prime-factors)
+ (recur (inc (inc search)) prime-factors count);;if is not prime increase the number being test by 2(even number won't be prime) and rerun
+ (if (> count 1)
+ (recur (inc (inc search)) prime-factors (dec count))
+ search))));;if is prime decrease how many more primes need to be found
+
+(nth-prime (last factors) factors (- n (count factors)));;finds the prime number 10001- current prime# "spots" away from the given input
+
+
+
+
+;;code below would be used for finding extremely large primes, as it takes a mathematical bound on the range
+;(defn lower-bound [k] (Math/floor (* k (+ (Math/log k) (Math/log (Math/log k)) -1))));;minmum value the nth prime could be n*(ln(n)+ln(ln(n))-1)
+;(def lower-value (int (lower-bound n)))
+;(defn next-prime [start-prime prime-factors]
+; (loop [search start-prime
+; prime-factors prime-factors]
+; (if (is-not-prime search prime-factors)
+; (recur (inc search) prime-factors)
+; search )))
+;;(next-prime lower-value factors)
\ No newline at end of file