Skip to content

Commit 29de0c4

Browse files
committed
Update dependent packages
1 parent 06ec330 commit 29de0c4

File tree

4 files changed

+19
-14
lines changed

4 files changed

+19
-14
lines changed

julia/Euler/Project.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,8 @@ Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa"
88
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
99
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
1010
Primes = "27ebfcd6-29c5-5fa9-bf4b-fb8fc14df3ae"
11+
12+
[compat]
13+
Combinatorics = "~1.0.3"
14+
DataStructures = "~0.19.0"
15+
Primes = "~0.5.7"

julia/Euler/src/bin/p0070.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
module Prob0070
2222

2323
import Primes: prevprime, primes
24-
import DataStructures: PriorityQueue, enqueue!, peek
24+
import DataStructures: PriorityQueue
2525

2626
LIMIT = 10 ^ 7 - 1
2727

@@ -93,26 +93,26 @@ function solve_0070()
9393
# initial data for pruning:
9494
# n = 87109 = 11 * 7919, phi(87109) = 79180
9595
pq = PriorityQueue{Vector{Tuple{Int, Int}}, Float64}()
96-
enqueue!(pq, [(11, 1), (7919, 1)] => (87109 / 79180) )
96+
push!(pq, [(11, 1), (7919, 1)] => (87109 / 79180) )
9797

9898
for p in reverse(primes(11, isqrt(LIMIT)))
9999
# pruning: end of search
100-
if get_ratio([(p, 1)]) > peek(pq)[2]
100+
if get_ratio([(p, 1)]) > first(pq)[2]
101101
break
102102
end
103103

104104
for pf_lst in Channel{Vector{Tuple{Int, Int}}}(c -> pf_generator(c, (p, prevprime(LIMIT ÷ p))))
105105
# pruning: skip to the next prime smaller than 'p'
106-
if get_ratio(pf_lst[1:min(length(pf_lst), 2)]) > peek(pq)[2]
106+
if get_ratio(pf_lst[1:min(length(pf_lst), 2)]) > first(pq)[2]
107107
break
108108
end
109109

110110
if is_perm(prod(pf_lst), phi(pf_lst)) == true
111-
enqueue!(pq, pf_lst => get_ratio(pf_lst))
111+
push!(pq, pf_lst => get_ratio(pf_lst))
112112
end
113113
end
114114
end
115-
prod(peek(pq)[1])
115+
prod(first(pq)[1])
116116
end
117117

118118
end #module

julia/Euler/src/bin/p0083.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
module Prob0083
1010

11-
import DataStructures: PriorityQueue, enqueue!, dequeue_pair!, peek, isempty
11+
import DataStructures: PriorityQueue
1212

1313
function make_neighbor_tbl(nrow, ncol)
1414
tbl = Array{Vector{Tuple{Int, Int}}}(undef, nrow, ncol)
@@ -26,14 +26,14 @@ function solve_0083(fname::String = "0083_matrix.txt")
2626
dist_tbl[1, 1] = data[1, 1]
2727

2828
pq = PriorityQueue{Tuple{Int, Int}, Int}()
29-
enqueue!(pq, (1, 1) => dist_tbl[1, 1])
29+
push!(pq, (1, 1) => dist_tbl[1, 1])
3030

3131
while isempty(pq) == false
32-
(i, j), d = dequeue_pair!(pq)
32+
(i, j), d = popfirst!(pq)
3333
for (x, y) in nbr_tbl[i, j]
3434
if (new_d = d + data[x, y]) < dist_tbl[x, y]
3535
dist_tbl[x, y] = new_d
36-
enqueue!(pq, (x, y) => new_d)
36+
push!(pq, (x, y) => new_d)
3737
end
3838
end
3939
end

julia/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ You can run the test suite in the Pkg REPL.
2222

2323
## Notes
2424

25-
It was confirmed to work with Julia v1.11.0.
25+
It was confirmed to work with Julia v1.11.6.
2626

2727
I used the following packages and their dependent packages.
2828

29-
- Combinatorics v1.0.2
30-
- DataStructures v0.18.20
29+
- Combinatorics v1.0.3
30+
- DataStructures v0.19.0
3131
- LinearAlgebra[^1]
32-
- Primes v0.5.6
32+
- Primes v0.5.7
3333

3434
[^1]: It's distributd with Julia.

0 commit comments

Comments
 (0)