aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-168/robert-dicicco/julia/ch-2.jl45
1 files changed, 45 insertions, 0 deletions
diff --git a/challenge-168/robert-dicicco/julia/ch-2.jl b/challenge-168/robert-dicicco/julia/ch-2.jl
new file mode 100644
index 0000000000..e486810da1
--- /dev/null
+++ b/challenge-168/robert-dicicco/julia/ch-2.jl
@@ -0,0 +1,45 @@
+#!julia.exe
+
+# AUTHOR: Robert DiCicco
+# DATE: 2022-06-07
+# Challenge 168 Home Primes ( Julia )
+
+using Primes
+
+results = []
+
+function homeprime( hp )
+
+ temp = []
+
+ s = " "
+
+ temp = factor(Array, hp)
+
+ for i in 1:length(temp)
+
+ s = s * repr(temp[i])
+
+ end
+
+ return(parse(Int64, s))
+
+end
+
+hp = 8
+
+flag = 1
+
+push!(results,hp)
+
+while flag > 0
+
+ retval = homeprime(hp)
+
+ push!(results,retval)
+
+ isprime(retval) ? (global flag = 0) : (global hp = retval)
+
+end
+
+println(results)