diff options
| author | Stephen Lynn <bizlsg@localhost.localdomain> | 2022-06-21 20:07:23 +0800 |
|---|---|---|
| committer | Stephen Lynn <bizlsg@localhost.localdomain> | 2022-06-21 20:13:33 +0800 |
| commit | 06c08c47a87dd59afa2c6554255b620123d7cf20 (patch) | |
| tree | 12267f42cd0bf6303d0aa92c3ef386fd32b38d9c | |
| parent | c96422e1af695197dbaf39b08ba0cd1dcb47f149 (diff) | |
| download | perlweeklychallenge-club-06c08c47a87dd59afa2c6554255b620123d7cf20.tar.gz perlweeklychallenge-club-06c08c47a87dd59afa2c6554255b620123d7cf20.tar.bz2 perlweeklychallenge-club-06c08c47a87dd59afa2c6554255b620123d7cf20.zip | |
qdded julia examples
| -rwxr-xr-x | challenge-170/steve-g-lynn/julia/ch-1.jl | 28 | ||||
| -rwxr-xr-x | challenge-170/steve-g-lynn/julia/ch-2.jl | 8 |
2 files changed, 36 insertions, 0 deletions
diff --git a/challenge-170/steve-g-lynn/julia/ch-1.jl b/challenge-170/steve-g-lynn/julia/ch-1.jl new file mode 100755 index 0000000000..f46a6fb449 --- /dev/null +++ b/challenge-170/steve-g-lynn/julia/ch-1.jl @@ -0,0 +1,28 @@ +#!/usr/bin/julia + +using Primes + +function nth_prime(n::Int64) + if (n==0) + return 1 + else + prevprime=nth_prime(n-1) + return nextprime(prevprime+1) + end +end + +function primorial(n::Int64) + if (n==0) + return 1 + else + return nth_prime(n)*primorial(n-1) + end +end + +for i in (0:10) + print("$(primorial(i)) ") +end + +println("") + + diff --git a/challenge-170/steve-g-lynn/julia/ch-2.jl b/challenge-170/steve-g-lynn/julia/ch-2.jl new file mode 100755 index 0000000000..509ce68270 --- /dev/null +++ b/challenge-170/steve-g-lynn/julia/ch-2.jl @@ -0,0 +1,8 @@ +#!/usr/bin/julia + +#kronecker product is a built-in function in julia + +println(kron([1 2;3 4],[5 6;7 8])) + +#[5 6 10 12; 7 8 14 16; 15 18 20 24; 21 24 28 32] + |
