One day, my friend texted me a problem out of the blue:
How many different bracelets can be made with 8 beads, where there are 2 red beads, 2 yellow beads, 2 green beads, and 2 blue beads?
(You must use all beads. Bracelets that can be transformed into one another by rotation or reflection do not count as different bracelets. That is, the bracelets have no beginning or end, no front or back. The beads are non-directed, it doesn’t matter which way they face.)
My initial strategy was to take the total number of “strings” that could be made from those beads (8! / 2^4) and then divide 8 to account for the number of possible rotational positions, then divide that by the number of axes of symmetry (8). However, my friend pointed out that this was wrong–some of these combinations are over-counted the same number of times.
I thought that it would be easiest to work through the problem if I started with the solution. So, I wrote up some quick code in Julia to count the number of unique combinations.
function is_equivalent(a, b)
for i in 1:length(a)
if a[i] != b[i]
return false
end
end
return true
end
is_equivalent (generic function with 1 method)
function is_rotationally_equivalent(a, b)
a_temp = a
for i in 1:length(a)
if is_equivalent(a_temp, b)
return true
end
a_temp = push!(a_temp[2:length(a)], a_temp[1])
end
return false
end
is_rotationally_equivalent (generic function with 1 method)
function is_symmetrically_and_rotationally_equivalent(a, b)
a_reversed = reverse(a)
if is_rotationally_equivalent(a, b)
return true
elseif is_rotationally_equivalent(a_reversed, b)
return true
else
return false
end
end
is_symmetrically_and_rotationally_equivalent (generic function with 1 method)
using Combinatorics
all_perms_list = collect(permutations(["r", "r", "g", "g", "b", "b", "y", "y"], 8))
keep_list = []
for i in 2:length(all_perms_list)
already_in_list = false
for j in 1:length(keep_list)
if is_symmetrically_and_rotationally_equivalent(all_perms_list[i], keep_list[j])
already_in_list = true
end
end
if !already_in_list
push!(keep_list, all_perms_list[i])
end
end
print(length(keep_list))
171
This code only took a couple of minutes to run (Julia’s speed always impresses me). The result was 171, and using the combinatorics techniques I had previously, I wasn’t able to reverse-engineer the answer.
Eventually, I came across a new technique that would help me solve this problem: Burnside’s lemma (also known as the Cauchy–Frobenius lemma).
This lemma is given as:
$|X/G| = \frac{1}{|G|} \sum_{g \in G}|X^g|$
I’ll explain some of the terms in this formula to make it more understandable:
X represents the set of all possible (non-unique) bracelets that can be made
G represents the group of possible reflections/rotations in our situation
|X/G| represents the number of “orbits” (or in our case, the number of unique bracelets that can be made)
|G| represents the number items in the “group” of reflections/rotations in our situation.
$g \in G$ indicates that the the summation iterates over all possible reflections/rotations in our situation
$X^g$ indicates the set of elements in X that are fixed by a given group. That is, the number of possible elements that do not change after the given reflection/rotation configuration is applied.
In order to understand how to apply burnside’s lemma, let’s first consider a simple situation: Imagine we want to determine how many unique combinations of 8 beads can be created, with 4 possible colors, and exactly 2 beads of each color in the string. Reverse sequences of the string count as the same string, so the following strings are equivalent:
using Graphs, GraphPlot
using Compose, Cairo, Fontconfig
using Colors
function create_graph(sequence, circular = true)
colors_dict = Dict([('r', 1), ('b', 2), ('y', 3), ('g', 4)])
membership_list = []
for letter in sequence
push!(membership_list, colors_dict[letter])
end
g = SimpleGraph(8)
for i in 1:7
add_edge!(g, i, i + 1)
end
if circular
add_edge!(g, 8, 1)
end
nodelabel = fill("", length(8))
nodecolor = [colorant"red", colorant"blue", colorant"yellow", colorant"green"]
# membership color
nodefillc = nodecolor[membership_list]
if circular
locs_x = [0, 1, 2, 3, 3, 2, 1, 0]
locs_y = [2, 3, 3, 2, 1, 0, 0, 1]
else
locs_x = [1, 2, 3, 4, 5, 6, 7, 8]
locs_y = repeat([0], 8)
end
g = gplot(g, locs_x, locs_y, nodefillc=nodefillc, )
draw(PNG(sequence * ["","circular"][circular * 1 + 1] * ".png", 16cm, 16cm),g)
g
end
create_graph (generic function with 2 methods)
create_graph("ryygbrbg", false)
<svg xmlns=“http://www.w3.org/2000/svg" xmlns:xlink=“http://www.w3.org/1999/xlink" version=“1.2” width=“141.42mm” height=“100mm” viewBox=“0 0 141.42 100” stroke=“none” fill="#000000” stroke-width=“0.3” font-size=“3.88”
id="img-237f1acd">
]]>
create_graph(reverse("ryygbrbg"), false)
<svg xmlns=“http://www.w3.org/2000/svg" xmlns:xlink=“http://www.w3.org/1999/xlink" version=“1.2” width=“141.42mm” height=“100mm” viewBox=“0 0 141.42 100” stroke=“none” fill="#000000” stroke-width=“0.3” font-size=“3.88”
id="img-7a975d17">
]]>
create_graph("ggbbyyrr", false)
<svg xmlns=“http://www.w3.org/2000/svg" xmlns:xlink=“http://www.w3.org/1999/xlink" version=“1.2” width=“141.42mm” height=“100mm” viewBox=“0 0 141.42 100” stroke=“none” fill="#000000” stroke-width=“0.3” font-size=“3.88”
id="img-0176efc2">
]]>
In this situation, there are two groups G: the null group (with no reverse order) and the group which applies the action of reversing the string. The number elements fixed by each group is:
For the null group: 8! / 2^4
For the “reversing string” group: 4!
A string can be fixed under reversal only if the first four beads are identical to the reverse of the last four beads:
create_graph("rgbyybgr", false)
<svg xmlns=“http://www.w3.org/2000/svg" xmlns:xlink=“http://www.w3.org/1999/xlink" version=“1.2” width=“141.42mm” height=“100mm” viewBox=“0 0 141.42 100” stroke=“none” fill="#000000” stroke-width=“0.3” font-size=“3.88”
id="img-f7654012">
]]>
The first four beads determine which arrangements are fixed under the reversal group, so there are 4! ways for strings to be fixed under reversibility.
So, $\sum_{g \in G}|X^g| = 8! / 2^4 + 4! = 2544$
Next, we just divide this by |G| (which is 2 in this situation) and we end up with 1272 possible strings.
We can double check this result using Julia:
function is_only_symmetrically_equivalent(a, b)
a_reversed = reverse(a)
if is_equivalent(a, b)
return true
elseif is_equivalent(a_reversed, b)
return true
else
return false
end
end
is_only_symmetrically_equivalent (generic function with 1 method)
all_perms_list = collect(permutations(["r", "r", "g", "g", "b", "b", "y", "y"], 8))
keep_list = []
for i in 2:length(all_perms_list)
already_in_list = false
for j in 1:length(keep_list)
if is_only_symmetrically_equivalent(all_perms_list[i], keep_list[j])
already_in_list = true
end
end
if !already_in_list
push!(keep_list, all_perms_list[i])
end
end
print(length(keep_list))
1272
Next, let’s apply burnside’s lemma to our original situation: a bracelet of 8 beads, with exactly 2 of each color, and taking into account non-distinctness of rotations and reflections. Here, we have 16 groups: the null group, 7 possible rotations, 4 reflections that intersect a bead, and 4 reflections that do not intersect a bead.
For the null group, we have 8! / 2^4 arrangements that remain “fixed”. When rotating 1-3 or 5-7 beads, there are 0 possible ways for an arrangement to remain “fixed” with this number of beads. You would need to have all lbeads be the same color for this to be valid.
however, when rotating 4 beads, it is possible for an arrangement to remain “fixed” if the last 4 beads repeat the first 4 beads. So, there are 4! fixed arrangments for that rotation group.
create_graph("rgybrgyb", true) ## RGYBRGYB plot
<svg xmlns=“http://www.w3.org/2000/svg" xmlns:xlink=“http://www.w3.org/1999/xlink" version=“1.2” width=“141.42mm” height=“100mm” viewBox=“0 0 141.42 100” stroke=“none” fill="#000000” stroke-width=“0.3” font-size=“3.88”
id="img-d4b3dbc5">
]]>
For each of the 8 reflections, there are 4! arrangements that remain fixed across that arrangement.
create_graph("rgybbygr", true) ## RGYBRGYB plot
<svg xmlns=“http://www.w3.org/2000/svg" xmlns:xlink=“http://www.w3.org/1999/xlink" version=“1.2” width=“141.42mm” height=“100mm” viewBox=“0 0 141.42 100” stroke=“none” fill="#000000” stroke-width=“0.3” font-size=“3.88”
id="img-227aef66">
]]>
create_graph("gybrbygr", true) ## RGYBRGYB plot
<svg xmlns=“http://www.w3.org/2000/svg" xmlns:xlink=“http://www.w3.org/1999/xlink" version=“1.2” width=“141.42mm” height=“100mm” viewBox=“0 0 141.42 100” stroke=“none” fill="#000000” stroke-width=“0.3” font-size=“3.88”
id="img-711cb9d3">
]]>
using Plots
create_graph("gybrbygr", true) ## RGYBRGYB plot
plot!(0, 1)
[36m[1m[ [22m[39m[36m[1mInfo: [22m[39mPrecompiling Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80]
signal (2): Interrupt: 2
in expression starting at none:1
Failed to precompile Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80] to /Users/zacharyclement/.julia/compiled/v1.8/Plots/jl_TVq3hx.
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool)
@ Base ./loading.jl:1707
[3] compilecache
@ ./loading.jl:1651 [inlined]
[4] _require(pkg::Base.PkgId)
@ Base ./loading.jl:1337
[5] _require_prelocked(uuidkey::Base.PkgId)
@ Base ./loading.jl:1200
[6] macro expansion
@ ./loading.jl:1180 [inlined]
[7] macro expansion
@ ./lock.jl:223 [inlined]
[8] require(into::Module, mod::Symbol)
@ Base ./loading.jl:1144
import Pkg; Pkg.add("Plots")
[32m[1m Updating[22m[39m registry at `~/.julia/registries/General.toml`
[32m[1m Resolving[22m[39m package versions...
[32m[1m Installed[22m[39m x265_jll ───────────────────── v3.5.0+0
[32m[1m Installed[22m[39m GR_jll ─────────────────────── v0.71.7+0
[32m[1m Installed[22m[39m LERC_jll ───────────────────── v3.0.0+1
[32m[1m Installed[22m[39m libfdk_aac_jll ─────────────── v2.0.2+0
[32m[1m Installed[22m[39m StatisticalTraits ──────────── v1.1.0
[32m[1m Installed[22m[39m Xorg_xkbcomp_jll ───────────── v1.4.2+4
[32m[1m Installed[22m[39m JpegTurbo_jll ──────────────── v2.1.91+0
[32m[1m Installed[22m[39m Opus_jll ───────────────────── v1.3.2+0
[32m[1m Installed[22m[39m RelocatableFolders ─────────── v1.0.0
[32m[1m Installed[22m[39m Grisu ──────────────────────── v1.0.2
[32m[1m Installed[22m[39m TimerOutputs ───────────────── v0.5.22
[32m[1m Installed[22m[39m JLSO ───────────────────────── v2.7.0
[32m[1m Installed[22m[39m Contour ────────────────────── v0.6.2
[32m[1m Installed[22m[39m Highlights ─────────────────── v0.5.2
[32m[1m Installed[22m[39m RCall ──────────────────────── v0.13.14
[32m[1m Installed[22m[39m Xorg_xcb_util_wm_jll ───────── v0.4.1+1
[32m[1m Installed[22m[39m StaticArrays ───────────────── v1.5.16
[32m[1m Installed[22m[39m Xorg_xcb_util_image_jll ────── v0.4.0+1
[32m[1m Installed[22m[39m PlotUtils ──────────────────── v1.2.0
[32m[1m Installed[22m[39m MLJScientificTypes ─────────── v0.4.5
[32m[1m Installed[22m[39m HTTP ───────────────────────── v0.9.17
[32m[1m Installed[22m[39m Memento ────────────────────── v1.4.1
[32m[1m Installed[22m[39m GPUArrays ──────────────────── v8.3.2
[32m[1m Installed[22m[39m DataFrames ─────────────────── v0.22.7
[32m[1m Installed[22m[39m Xorg_xcb_util_jll ──────────── v0.4.0+1
[32m[1m Installed[22m[39m BFloat16s ──────────────────── v0.2.0
[32m[1m Installed[22m[39m RecipesPipeline ────────────── v0.6.11
[32m[1m Installed[22m[39m CEnum ──────────────────────── v0.4.2
[32m[1m Installed[22m[39m RandomNumbers ──────────────── v1.5.3
[32m[1m Installed[22m[39m MLJModels ──────────────────── v0.13.3
[32m[1m Installed[22m[39m CodeTracking ───────────────── v1.2.1
[32m[1m Installed[22m[39m ColorSchemes ───────────────── v3.20.0
[32m[1m Installed[22m[39m Polynomials ────────────────── v3.2.5
[32m[1m Installed[22m[39m CUDA_Runtime_jll ───────────── v0.3.1+0
[32m[1m Installed[22m[39m Xorg_libxkbfile_jll ────────── v1.1.0+4
[32m[1m Installed[22m[39m Xorg_libXinerama_jll ───────── v1.1.4+4
[32m[1m Installed[22m[39m Distances ──────────────────── v0.10.7
[32m[1m Installed[22m[39m Fontconfig ─────────────────── v0.4.1
[32m[1m Installed[22m[39m FFMPEG ─────────────────────── v0.4.1
[32m[1m Installed[22m[39m FiniteDiff ─────────────────── v2.18.0
[32m[1m Installed[22m[39m Showoff ────────────────────── v1.0.3
[32m[1m Installed[22m[39m XGBoost_jll ────────────────── v1.7.4+0
[32m[1m Installed[22m[39m LLVM ───────────────────────── v4.16.0
[32m[1m Installed[22m[39m Qt5Base_jll ────────────────── v5.15.3+2
[32m[1m Installed[22m[39m CUDA_Driver_jll ────────────── v0.3.0+1
[32m[1m Installed[22m[39m Xorg_xcb_util_keysyms_jll ──── v0.4.0+1
[32m[1m Installed[22m[39m xkbcommon_jll ──────────────── v1.4.1+0
[32m[1m Installed[22m[39m SpecialFunctions ───────────── v1.8.8
[32m[1m Installed[22m[39m ProgressLogging ────────────── v0.1.4
[32m[1m Installed[22m[39m Term ───────────────────────── v2.0.1
[32m[1m Installed[22m[39m Pipe ───────────────────────── v1.3.0
[32m[1m Installed[22m[39m NaNMath ────────────────────── v1.0.2
[32m[1m Installed[22m[39m PlotThemes ─────────────────── v3.1.0
[32m[1m Installed[22m[39m MyterialColors ─────────────── v0.3.0
[32m[1m Installed[22m[39m GR ─────────────────────────── v0.71.7
[32m[1m Installed[22m[39m fzf_jll ────────────────────── v0.29.0+0
[32m[1m Installed[22m[39m TranscodingStreams ─────────── v0.9.11
[32m[1m Installed[22m[39m SnoopPrecompile ────────────── v1.0.3
[32m[1m Installed[22m[39m Rmath_jll ──────────────────── v0.4.0+0
[32m[1m Installed[22m[39m UnicodeFun ─────────────────── v0.4.1
[32m[1m Installed[22m[39m Random123 ──────────────────── v1.6.0
[32m[1m Installed[22m[39m ScikitLearn ────────────────── v0.7.0
[32m[1m Installed[22m[39m MLJBase ────────────────────── v0.16.3
[32m[1m Installed[22m[39m Graphs ─────────────────────── v1.8.0
[32m[1m Installed[22m[39m GLFW_jll ───────────────────── v3.3.8+0
[32m[1m Installed[22m[39m ComputationalResources ─────── v0.3.2
[32m[1m Installed[22m[39m x264_jll ───────────────────── v2021.5.5+0
[32m[1m Installed[22m[39m JLFzf ──────────────────────── v0.1.5
[32m[1m Installed[22m[39m LinearAlgebraX ─────────────── v0.1.11
[32m[1m Installed[22m[39m Compat ─────────────────────── v3.46.1
[32m[1m Installed[22m[39m ExprTools ──────────────────── v0.1.8
[32m[1m Installed[22m[39m libaom_jll ─────────────────── v3.4.0+0
[32m[1m Installed[22m[39m CodecZlib ──────────────────── v0.7.1
[32m[1m Installed[22m[39m DiffRules ──────────────────── v1.13.0
[32m[1m Installed[22m[39m ColorTypes ─────────────────── v0.10.12
[32m[1m Installed[22m[39m Scratch ────────────────────── v1.1.1
[32m[1m Installed[22m[39m Conda ──────────────────────── v1.8.0
[32m[1m Installed[22m[39m JSON3 ──────────────────────── v1.12.0
[32m[1m Installed[22m[39m Zstd_jll ───────────────────── v1.5.4+0
[32m[1m Installed[22m[39m Parsers ────────────────────── v2.5.7
[32m[1m Installed[22m[39m TensorCore ─────────────────── v0.1.1
[32m[1m Installed[22m[39m Plots ──────────────────────── v1.38.6
[32m[1m Installed[22m[39m MLJ ────────────────────────── v0.15.2
[32m[1m Installed[22m[39m PrettyTables ───────────────── v0.10.1
[32m[1m Installed[22m[39m PersistenceDiagramsBase ────── v0.1.1
[32m[1m Installed[22m[39m ScientificTypes ────────────── v1.1.2
[32m[1m Installed[22m[39m PyCall ─────────────────────── v1.95.1
[32m[1m Installed[22m[39m AbstractFFTs ───────────────── v1.2.1
[32m[1m Installed[22m[39m ConstructionBase ───────────── v1.5.1
[32m[1m Installed[22m[39m CategoricalArrays ──────────── v0.9.7
[32m[1m Installed[22m[39m Libtiff_jll ────────────────── v4.4.0+0
[32m[1m Installed[22m[39m LLVMExtra_jll ──────────────── v0.0.16+2
[32m[1m Installed[22m[39m Ogg_jll ────────────────────── v1.3.5+1
[32m[1m Installed[22m[39m Xorg_libXi_jll ─────────────── v1.7.10+4
[32m[1m Installed[22m[39m ColorVectorSpace ───────────── v0.9.10
[32m[1m Installed[22m[39m AbstractTrees ──────────────── v0.4.4
[32m[1m Installed[22m[39m ArrayInterface ─────────────── v7.1.0
[32m[1m Installed[22m[39m ChainRulesCore ─────────────── v1.15.7
[32m[1m Installed[22m[39m LogExpFunctions ────────────── v0.3.23
[32m[1m Installed[22m[39m Xorg_xcb_util_renderutil_jll ─ v0.3.9+1
[32m[1m Installed[22m[39m Xorg_libXcursor_jll ────────── v1.2.0+4
[32m[1m Installed[22m[39m Wayland_protocols_jll ──────── v1.25.0+0
[32m[1m Installed[22m[39m SparseMatricesCSR ──────────── v0.6.7
[32m[1m Installed[22m[39m Compose ────────────────────── v0.9.5
[32m[1m Installed[22m[39m MLJTuning ──────────────────── v0.6.0
[32m[1m Installed[22m[39m libass_jll ─────────────────── v0.15.1+0
[32m[1m Installed[22m[39m StableRNGs ─────────────────── v1.0.0
[32m[1m Installed[22m[39m Rmath ──────────────────────── v0.7.1
[32m[1m Installed[22m[39m Adapt ──────────────────────── v3.5.0
[32m[1m Installed[22m[39m Latexify ───────────────────── v0.15.18
[32m[1m Installed[22m[39m MLJModelInterface ──────────── v0.3.8
[32m[1m Installed[22m[39m Wayland_jll ────────────────── v1.21.0+0
[32m[1m Installed[22m[39m OpenSSL_jll ────────────────── v1.1.20+0
[32m[1m Installed[22m[39m FFMPEG_jll ─────────────────── v4.4.2+2
[32m[1m Installed[22m[39m GPUCompiler ────────────────── v0.17.2
[32m[1m Installed[22m[39m MakieCore ──────────────────── v0.6.2
[32m[1m Installed[22m[39m Xorg_xkeyboard_config_jll ──── v2.27.0+4
[32m[1m Installed[22m[39m RecipesBase ────────────────── v1.3.3
[32m[1m Installed[22m[39m Xorg_libXfixes_jll ─────────── v5.0.3+4
[32m[1m Installed[22m[39m Xorg_libXrandr_jll ─────────── v1.5.2+4
[32m[1m Installed[22m[39m URIs ───────────────────────── v1.4.2
[32m[1m Installed[22m[39m XGBoost ────────────────────── v2.2.5
[32m[1m Installed[22m[39m LAME_jll ───────────────────── v3.100.1+0
[32m[1m Installed[22m[39m FilePathsBase ──────────────── v0.9.20
[32m[1m Installed[22m[39m libvorbis_jll ──────────────── v1.3.7+1
[32m[1m Installed[22m[39m Libglvnd_jll ───────────────── v1.6.0+0
[32m[1m Installed[22m[39m ForwardDiff ────────────────── v0.10.35
[32m[1m Installed[22m[39m FillArrays ─────────────────── v0.11.9
[32m[1m Installed[22m[39m LearnBase ──────────────────── v0.4.1
[32m[1m Installed[22m[39m QuadGK ─────────────────────── v2.8.1
[32m[1m Installed[22m[39m BSON ───────────────────────── v0.3.6
[32m[1m Installed[22m[39m Observables ────────────────── v0.5.4
[32m[1m Installed[22m[39m Unzip ──────────────────────── v0.2.0
[32m[1m Installed[22m[39m Lathe ──────────────────────── v0.1.6
[32m[1m Installed[22m[39m DecisionTree ───────────────── v0.12.3
[32m[1m Installed[22m[39m ChangesOfVariables ─────────── v0.1.6
[32m[1m Installed[22m[39m LossFunctions ──────────────── v0.6.2
[32m[1m Installed[22m[39m Distributions ──────────────── v0.24.18
[32m[1m Installed[22m[39m CUDA ───────────────────────── v3.13.1
[32m[1m Installed[22m[39m LatinHypercubeSampling ─────── v1.8.0
[32m[1m Updating[22m[39m `~/.julia/environments/v1.8/Project.toml`
[90m [a81c6b42] [39m[93m↑ Compose v0.9.4 ⇒ v0.9.5[39m
[33m⌅[39m[90m [a93c6f00] [39m[93m↑ DataFrames v0.19.4 ⇒ v0.22.7[39m
[90m [7806a523] [39m[93m↑ DecisionTree v0.12.1 ⇒ v0.12.3[39m
[33m⌅[39m[90m [31c24e10] [39m[93m↑ Distributions v0.21.12 ⇒ v0.24.18[39m
[90m [186bb1d3] [39m[93m↑ Fontconfig v0.4.0 ⇒ v0.4.1[39m
[90m [da1fdf0e] [39m[93m↑ FreqTables v0.3.1 ⇒ v0.4.5[39m
[90m [38e38edf] [39m[93m↑ GLM v1.4.2 ⇒ v1.8.1[39m
[90m [86223c79] [39m[93m↑ Graphs v1.5.0 ⇒ v1.8.0[39m
[32m⌃[39m[90m [38d8eb38] [39m[93m↑ Lathe v0.0.9 ⇒ v0.1.6[39m
[32m⌃[39m[90m [add582a8] [39m[93m↑ MLJ v0.2.3 ⇒ v0.15.2[39m
[90m [91a5bcdd] [39m[92m+ Plots v1.38.6[39m
[33m⌅[39m[90m [08abe8d2] [39m[95m↓ PrettyTables v2.2.2 ⇒ v0.10.1[39m
[90m [6f49c342] [39m[93m↑ RCall v0.13.5 ⇒ v0.13.14[39m
[90m [3646fa90] [39m[93m↑ ScikitLearn v0.5.0 ⇒ v0.7.0[39m
[90m [009559a3] [39m[93m↑ XGBoost v1.5.2 ⇒ v2.2.5[39m
[32m[1m Updating[22m[39m `~/.julia/environments/v1.8/Manifest.toml`
[90m [621f4979] [39m[92m+ AbstractFFTs v1.2.1[39m
[90m [1520ce14] [39m[93m↑ AbstractTrees v0.4.3 ⇒ v0.4.4[39m
[90m [79e6a3ab] [39m[92m+ Adapt v3.5.0[39m
[90m [7d9fca2a] [39m[91m- Arpack v0.4.0[39m
[90m [4fba245c] [39m[92m+ ArrayInterface v7.1.0[39m
[33m⌅[39m[90m [ab4f0b2a] [39m[92m+ BFloat16s v0.2.0[39m
[90m [fbb218c0] [39m[92m+ BSON v0.3.6[39m
[90m [fa961155] [39m[92m+ CEnum v0.4.2[39m
[90m [336ed68f] [39m[91m- CSV v0.4.0[39m
[32m⌃[39m[90m [052768ef] [39m[92m+ CUDA v3.13.1[39m
[90m [49dc2e85] [39m[91m- Calculus v0.5.1[39m
[33m⌅[39m[90m [324d7699] [39m[93m↑ CategoricalArrays v0.5.5 ⇒ v0.9.7[39m
[90m [d360d2e6] [39m[93m↑ ChainRulesCore v1.15.6 ⇒ v1.15.7[39m
[90m [9e997f8a] [39m[93m↑ ChangesOfVariables v0.1.4 ⇒ v0.1.6[39m
[90m [da1fd8a2] [39m[92m+ CodeTracking v1.2.1[39m
[90m [944b1d66] [39m[92m+ CodecZlib v0.7.1[39m
[90m [35d6a980] [39m[92m+ ColorSchemes v3.20.0[39m
[33m⌅[39m[90m [3da002f7] [39m[95m↓ ColorTypes v0.11.4 ⇒ v0.10.12[39m
[90m [c3611d14] [39m[92m+ ColorVectorSpace v0.9.10[39m
[33m⌅[39m[90m [34da2185] [39m[93m↑ Compat v2.2.1 ⇒ v3.46.1[39m
[90m [a81c6b42] [39m[93m↑ Compose v0.9.4 ⇒ v0.9.5[39m
[90m [ed09eef8] [39m[92m+ ComputationalResources v0.3.2[39m
[90m [8f4d0f93] [39m[93m↑ Conda v1.7.0 ⇒ v1.8.0[39m
[90m [187b0558] [39m[92m+ ConstructionBase v1.5.1[39m
[90m [d38c429a] [39m[92m+ Contour v0.6.2[39m
[33m⌅[39m[90m [a93c6f00] [39m[93m↑ DataFrames v0.19.4 ⇒ v0.22.7[39m
[90m [9a8bc11e] [39m[91m- DataStreams v0.4.2[39m
[90m [864edb3b] [39m[93m↑ DataStructures v0.17.20 ⇒ v0.18.13[39m
[90m [7806a523] [39m[93m↑ DecisionTree v0.12.1 ⇒ v0.12.3[39m
[90m [01453d9d] [39m[91m- DiffEqDiffTools v0.14.0[39m
[90m [b552c78f] [39m[93m↑ DiffRules v1.7.0 ⇒ v1.13.0[39m
[90m [b4f34e82] [39m[93m↑ Distances v0.8.2 ⇒ v0.10.7[39m
[33m⌅[39m[90m [31c24e10] [39m[93m↑ Distributions v0.21.12 ⇒ v0.24.18[39m
[90m [e2ba6199] [39m[92m+ ExprTools v0.1.8[39m
[90m [c87230d0] [39m[92m+ FFMPEG v0.4.1[39m
[90m [5789e2e9] [39m[91m- FileIO v1.16.0[39m
[90m [48062228] [39m[92m+ FilePathsBase v0.9.20[39m
[33m⌅[39m[90m [1a297f60] [39m[93m↑ FillArrays v0.8.14 ⇒ v0.11.9[39m
[90m [6a86dc24] [39m[92m+ FiniteDiff v2.18.0[39m
[90m [186bb1d3] [39m[93m↑ Fontconfig v0.4.0 ⇒ v0.4.1[39m
[90m [f6369f11] [39m[93m↑ ForwardDiff v0.10.34 ⇒ v0.10.35[39m
[90m [da1fdf0e] [39m[93m↑ FreqTables v0.3.1 ⇒ v0.4.5[39m
[90m [38e38edf] [39m[93m↑ GLM v1.4.2 ⇒ v1.8.1[39m
[32m⌃[39m[90m [0c68f7d7] [39m[92m+ GPUArrays v8.3.2[39m
[90m [61eb1bfa] [39m[92m+ GPUCompiler v0.17.2[39m
[90m [28b8d3ca] [39m[92m+ GR v0.71.7[39m
[90m [86223c79] [39m[93m↑ Graphs v1.5.0 ⇒ v1.8.0[39m
[90m [42e2da0e] [39m[92m+ Grisu v1.0.2[39m
[33m⌅[39m[90m [cd3eb016] [39m[93m↑ HTTP v0.8.19 ⇒ v0.9.17[39m
[90m [eafb193a] [39m[92m+ Highlights v0.5.2[39m
[90m [1019f520] [39m[92m+ JLFzf v0.1.5[39m
[90m [9da8a3cd] [39m[92m+ JLSO v2.7.0[39m
[90m [0f8b85d8] [39m[92m+ JSON3 v1.12.0[39m
[90m [2d691ee1] [39m[91m- LIBLINEAR v0.5.1[39m
[90m [b1bec4e5] [39m[91m- LIBSVM v0.4.0[39m
[90m [929cbde3] [39m[92m+ LLVM v4.16.0[39m
[90m [23fbe1c1] [39m[92m+ Latexify v0.15.18[39m
[32m⌃[39m[90m [38d8eb38] [39m[93m↑ Lathe v0.0.9 ⇒ v0.1.6[39m
[90m [a5e1c1ea] [39m[92m+ LatinHypercubeSampling v1.8.0[39m
[33m⌅[39m[90m [7f8f8fb0] [39m[92m+ LearnBase v0.4.1[39m
[90m [d3d80556] [39m[93m↑ LineSearches v7.1.1 ⇒ v7.2.0[39m
[90m [9b3f67b0] [39m[93m↑ LinearAlgebraX v0.1.10 ⇒ v0.1.11[39m
[90m [2ab3a3ac] [39m[93m↑ LogExpFunctions v0.3.19 ⇒ v0.3.23[39m
[33m⌅[39m[90m [30fc2ffe] [39m[92m+ LossFunctions v0.6.2[39m
[32m⌃[39m[90m [add582a8] [39m[93m↑ MLJ v0.2.3 ⇒ v0.15.2[39m
[33m⌅[39m[90m [a7f614a8] [39m[93m↑ MLJBase v0.2.1 ⇒ v0.16.3[39m
[33m⌅[39m[90m [e80e1ace] [39m[92m+ MLJModelInterface v0.3.8[39m
[33m⌅[39m[90m [d491faf4] [39m[93m↑ MLJModels v0.2.3 ⇒ v0.13.3[39m
[32m⌃[39m[90m [2e2323e0] [39m[92m+ MLJScientificTypes v0.4.5[39m
[33m⌅[39m[90m [03970b2e] [39m[92m+ MLJTuning v0.6.0[39m
[90m [20f20a25] [39m[92m+ MakieCore v0.6.2[39m
[90m [f28f55f0] [39m[92m+ Memento v1.4.1[39m
[90m [1c23619d] [39m[92m+ MyterialColors v0.3.0[39m
[90m [d41bc354] [39m[93m↑ NLSolversBase v7.5.0 ⇒ v7.8.3[39m
[90m [77ba4419] [39m[93m↑ NaNMath v0.3.7 ⇒ v1.0.2[39m
[90m [86f7a689] [39m[93m↑ NamedArrays v0.9.4 ⇒ v0.9.6[39m
[90m [510215fc] [39m[92m+ Observables v0.5.4[39m
[90m [429524aa] [39m[93m↑ Optim v0.20.1 ⇒ v1.7.4[39m
[90m [90014a1f] [39m[93m↑ PDMats v0.9.12 ⇒ v0.11.16[39m
[90m [69de0a69] [39m[93m↑ Parsers v2.5.2 ⇒ v2.5.7[39m
[90m [b1ad91c1] [39m[92m+ PersistenceDiagramsBase v0.1.1[39m
[90m [b98c9c47] [39m[92m+ Pipe v1.3.0[39m
[90m [ccf2f8ad] [39m[92m+ PlotThemes v3.1.0[39m
[32m⌃[39m[90m [995b91a9] [39m[92m+ PlotUtils v1.2.0[39m
[90m [91a5bcdd] [39m[92m+ Plots v1.38.6[39m
[90m [f27b6e38] [39m[93m↑ Polynomials v3.2.0 ⇒ v3.2.5[39m
[90m [2dfb63ee] [39m[93m↑ PooledArrays v0.5.3 ⇒ v1.4.2[39m
[33m⌅[39m[90m [08abe8d2] [39m[95m↓ PrettyTables v2.2.2 ⇒ v0.10.1[39m
[90m [33c8b6b6] [39m[92m+ ProgressLogging v0.1.4[39m
[90m [438e738f] [39m[93m↑ PyCall v1.94.1 ⇒ v1.95.1[39m
[90m [1fd47b50] [39m[93m↑ QuadGK v2.6.0 ⇒ v2.8.1[39m
[90m [6f49c342] [39m[93m↑ RCall v0.13.5 ⇒ v0.13.14[39m
[90m [74087812] [39m[92m+ Random123 v1.6.0[39m
[90m [e6cf234a] [39m[92m+ RandomNumbers v1.5.3[39m
[90m [3cdcf5f2] [39m[93m↑ RecipesBase v0.7.0 ⇒ v1.3.3[39m
[90m [01d81517] [39m[92m+ RecipesPipeline v0.6.11[39m
[90m [05181044] [39m[92m+ RelocatableFolders v1.0.0[39m
[90m [cbe49d4c] [39m[91m- RemoteFiles v0.3.1[39m
[90m [79098fc4] [39m[93m↑ Rmath v0.7.0 ⇒ v0.7.1[39m
[33m⌅[39m[90m [321657f4] [39m[92m+ ScientificTypes v1.1.2[39m
[90m [3646fa90] [39m[93m↑ ScikitLearn v0.5.0 ⇒ v0.7.0[39m
[90m [6c6a2e73] [39m[92m+ Scratch v1.1.1[39m
[90m [efcf1570] [39m[92m+ Setfield v1.1.1[39m
[90m [1277b4bf] [39m[93m↑ ShiftedArrays v1.0.0 ⇒ v2.0.0[39m
[90m [992d4aef] [39m[92m+ Showoff v1.0.3[39m
[90m [66db9d55] [39m[93m↑ SnoopPrecompile v1.0.1 ⇒ v1.0.3[39m
[90m [a0a7dd2c] [39m[92m+ SparseMatricesCSR v0.6.7[39m
[33m⌅[39m[90m [276daf66] [39m[93m↑ SpecialFunctions v0.9.0 ⇒ v1.8.8[39m
[90m [860ef19b] [39m[92m+ StableRNGs v1.0.0[39m
[90m [90137ffa] [39m[93m↑ StaticArrays v0.12.5 ⇒ v1.5.16[39m
[33m⌅[39m[90m [64bff920] [39m[92m+ StatisticalTraits v1.1.0[39m
[90m [82ae8749] [39m[92m+ StatsAPI v1.5.0[39m
[90m [2913bbd2] [39m[93m↑ StatsBase v0.32.2 ⇒ v0.33.21[39m
[90m [3eaba693] [39m[93m↑ StatsModels v0.6.21 ⇒ v0.6.33[39m
[90m [892a3eda] [39m[91m- StringManipulation v0.3.0[39m
[90m [856f2bd8] [39m[92m+ StructTypes v1.10.0[39m
[90m [bd369af6] [39m[93m↑ Tables v0.2.11 ⇒ v1.10.0[39m
[90m [62fd8b95] [39m[92m+ TensorCore v0.1.1[39m
[90m [22787eb5] [39m[92m+ Term v2.0.1[39m
[90m [a759f4b9] [39m[92m+ TimerOutputs v0.5.22[39m
[90m [3bb67fe8] [39m[92m+ TranscodingStreams v0.9.11[39m
[90m [5c2747f8] [39m[92m+ URIs v1.4.2[39m
[90m [1cfade01] [39m[92m+ UnicodeFun v0.4.1[39m
[90m [41fe7b60] [39m[92m+ Unzip v0.2.0[39m
[90m [ea10d353] [39m[91m- WeakRefStrings v0.5.8[39m
[90m [009559a3] [39m[93m↑ XGBoost v1.5.2 ⇒ v2.2.5[39m
[90m [68821587] [39m[91m- Arpack_jll v3.5.1+1[39m
[90m [4ee394cb] [39m[93m↑ CUDA_Driver_jll v0.2.0+0 ⇒ v0.3.0+1[39m
[90m [76a88914] [39m[93m↑ CUDA_Runtime_jll v0.2.3+2 ⇒ v0.3.1+0[39m
[90m [b22a6f82] [39m[92m+ FFMPEG_jll v4.4.2+2[39m
[90m [0656b61e] [39m[92m+ GLFW_jll v3.3.8+0[39m
[90m [d2c73de3] [39m[92m+ GR_jll v0.71.7+0[39m
[90m [aacddb02] [39m[92m+ JpegTurbo_jll v2.1.91+0[39m
[90m [c1c5ebd0] [39m[92m+ LAME_jll v3.100.1+0[39m
[90m [88015f11] [39m[92m+ LERC_jll v3.0.0+1[39m
[90m [dad2f222] [39m[92m+ LLVMExtra_jll v0.0.16+2[39m
[90m [7e76a0d4] [39m[92m+ Libglvnd_jll v1.6.0+0[39m
[90m [89763e89] [39m[92m+ Libtiff_jll v4.4.0+0[39m
[90m [e7412a2a] [39m[92m+ Ogg_jll v1.3.5+1[39m
[90m [458c3c95] [39m[92m+ OpenSSL_jll v1.1.20+0[39m
[90m [91d4177d] [39m[92m+ Opus_jll v1.3.2+0[39m
[90m [ea2cea3b] [39m[92m+ Qt5Base_jll v5.15.3+2[39m
[90m [f50d1b31] [39m[93m↑ Rmath_jll v0.3.0+0 ⇒ v0.4.0+0[39m
[90m [a2964d1f] [39m[92m+ Wayland_jll v1.21.0+0[39m
[90m [2381bf8a] [39m[92m+ Wayland_protocols_jll v1.25.0+0[39m
[90m [a5c6f535] [39m[93m↑ XGBoost_jll v1.7.2+0 ⇒ v1.7.4+0[39m
[90m [935fb764] [39m[92m+ Xorg_libXcursor_jll v1.2.0+4[39m
[90m [d091e8ba] [39m[92m+ Xorg_libXfixes_jll v5.0.3+4[39m
[90m [a51aa0fd] [39m[92m+ Xorg_libXi_jll v1.7.10+4[39m
[90m [d1454406] [39m[92m+ Xorg_libXinerama_jll v1.1.4+4[39m
[90m [ec84b674] [39m[92m+ Xorg_libXrandr_jll v1.5.2+4[39m
[90m [cc61e674] [39m[92m+ Xorg_libxkbfile_jll v1.1.0+4[39m
[90m [12413925] [39m[92m+ Xorg_xcb_util_image_jll v0.4.0+1[39m
[90m [2def613f] [39m[92m+ Xorg_xcb_util_jll v0.4.0+1[39m
[90m [975044d2] [39m[92m+ Xorg_xcb_util_keysyms_jll v0.4.0+1[39m
[90m [0d47668e] [39m[92m+ Xorg_xcb_util_renderutil_jll v0.3.9+1[39m
[90m [c22f9ab0] [39m[92m+ Xorg_xcb_util_wm_jll v0.4.1+1[39m
[90m [35661453] [39m[92m+ Xorg_xkbcomp_jll v1.4.2+4[39m
[90m [33bec58e] [39m[92m+ Xorg_xkeyboard_config_jll v2.27.0+4[39m
[90m [3161d3a3] [39m[92m+ Zstd_jll v1.5.4+0[39m
[33m⌅[39m[90m [214eeab7] [39m[92m+ fzf_jll v0.29.0+0[39m
[90m [a4ae2306] [39m[92m+ libaom_jll v3.4.0+0[39m
[90m [0ac62f75] [39m[92m+ libass_jll v0.15.1+0[39m
[90m [f638f0a6] [39m[92m+ libfdk_aac_jll v2.0.2+0[39m
[90m [f27f6e37] [39m[92m+ libvorbis_jll v1.3.7+1[39m
[90m [1270edf5] [39m[92m+ x264_jll v2021.5.5+0[39m
[90m [dfaa095f] [39m[92m+ x265_jll v3.5.0+0[39m
[90m [d8fb68d0] [39m[92m+ xkbcommon_jll v1.4.1+0[39m
[90m [9abbd945] [39m[91m- Profile[39m
[90m [05823500] [39m[92m+ OpenLibm_jll v0.8.1+0[39m
[36m[1m Info[22m[39m Packages marked with [32m⌃[39m and [33m⌅[39m have new versions available, but those with [33m⌅[39m are restricted by compatibility constraints from upgrading. To see why use `status --outdated -m`
[32m[1m Building[22m[39m Conda ─→ `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/e32a90da027ca45d84678b826fffd3110bb3fc90/build.log`
[32m[1m Building[22m[39m PyCall → `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/62f417f6ad727987c755549e9cd88c46578da562/build.log`
[32m[1m Building[22m[39m RCall ─→ `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/2c0ffd39860c9a48259a0f57214ced2024ab63bc/build.log`
Error building `RCall`:
ERROR: could not load library "/Volumes/SanDisk/opt/anaconda3/lib/R/lib/libR.dylib"
dlopen(/Volumes/SanDisk/opt/anaconda3/lib/R/lib/libR.dylib, 0x0001): Library not loaded: @rpath/libreadline.6.2.dylib
Referenced from: <185433D7-8B40-31AA-8BD9-465D23C57257> /Volumes/SanDisk/opt/anaconda3/lib/R/lib/libR.dylib
Reason: tried: '/Volumes/SanDisk/opt/anaconda3/lib/R/lib/../../libreadline.6.2.dylib' (no such file), '/Volumes/SanDisk/opt/anaconda3/lib/R/lib/../../libreadline.6.2.dylib' (no such file), '/Applications/Julia-1.8.app/Contents/Resources/julia/lib/julia/libreadline.6.2.dylib' (no such file), '/Applications/Julia-1.8.app/Contents/Resources/julia/lib/libreadline.6.2.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS@rpath/libreadline.6.2.dylib' (no such file), '/Volumes/SanDisk/opt/anaconda3/lib/R/lib/../../libreadline.6.2.dylib' (no such file), '/Volumes/SanDisk/opt/anaconda3/lib/R/lib/../../libreadline.6.2.dylib' (no such file), '/Applications/Julia-1.8.app/Contents/Resources/julia/lib/julia/libreadline.6.2.dylib' (no such file), '/Applications/Julia-1.8.app/Contents/Resources/julia/lib/libreadline.6.2.dylib' (no such file), '/usr/local/lib/libreadline.6.2.dylib' (no such file), '/usr/lib/libreadline.6.2.dylib' (no such file, not in dyld cache)
ERROR: LoadError: Try adding /Volumes/SanDisk/opt/anaconda3/lib/R/lib to the "LD_LIBRARY_PATH" environmental variable and restarting Julia.
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] validate_libR(libR::String)
@ Main ~/.julia/packages/RCall/Wyd74/deps/setup.jl:26
[3] locate_libR(Rhome::SubString{String})
@ Main ~/.julia/packages/RCall/Wyd74/deps/setup.jl:43
[4] top-level scope
@ ~/.julia/packages/RCall/Wyd74/deps/build.jl:58
[5] include(fname::String)
@ Base.MainInclude ./client.jl:476
[6] top-level scope
@ none:5
in expression starting at /Users/zacharyclement/.julia/packages/RCall/Wyd74/deps/build.jl:11
caused by: could not load library "/Volumes/SanDisk/opt/anaconda3/lib/R/lib/libR.dylib"
dlopen(/Volumes/SanDisk/opt/anaconda3/lib/R/lib/libR.dylib, 0x0001): Library not loaded: @rpath/libreadline.6.2.dylib
Referenced from: <185433D7-8B40-31AA-8BD9-465D23C57257> /Volumes/SanDisk/opt/anaconda3/lib/R/lib/libR.dylib
Reason: tried: '/Volumes/SanDisk/opt/anaconda3/lib/R/lib/../../libreadline.6.2.dylib' (no such file), '/Volumes/SanDisk/opt/anaconda3/lib/R/lib/../../libreadline.6.2.dylib' (no such file), '/Applications/Julia-1.8.app/Contents/Resources/julia/lib/julia/libreadline.6.2.dylib' (no such file), '/Applications/Julia-1.8.app/Contents/Resources/julia/lib/libreadline.6.2.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS@rpath/libreadline.6.2.dylib' (no such file), '/Volumes/SanDisk/opt/anaconda3/lib/R/lib/../../libreadline.6.2.dylib' (no such file), '/Volumes/SanDisk/opt/anaconda3/lib/R/lib/../../libreadline.6.2.dylib' (no such file), '/Applications/Julia-1.8.app/Contents/Resources/julia/lib/julia/libreadline.6.2.dylib' (no such file), '/Applications/Julia-1.8.app/Contents/Resources/julia/lib/libreadline.6.2.dylib' (no such file), '/usr/local/lib/libreadline.6.2.dylib' (no such file), '/usr/lib/libreadline.6.2.dylib' (no such file, not in dyld cache)
Stacktrace:
[1] dlopen(s::String, flags::UInt32; throw_error::Bool)
@ Base.Libc.Libdl ./libdl.jl:117
[2] dlopen (repeats 2 times)
@ ./libdl.jl:116 [inlined]
[3] validate_libR(libR::String)
@ Main ~/.julia/packages/RCall/Wyd74/deps/setup.jl:16
[4] locate_libR(Rhome::SubString{String})
@ Main ~/.julia/packages/RCall/Wyd74/deps/setup.jl:43
[5] top-level scope
@ ~/.julia/packages/RCall/Wyd74/deps/build.jl:58
[6] include(fname::String)
@ Base.MainInclude ./client.jl:476
[7] top-level scope
@ none:5
Stacktrace:
[1] pkgerror(msg::String)
@ Pkg.Types /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/Types.jl:67
[2] (::Pkg.Operations.var"#66#73"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec, String})()
@ Pkg.Operations /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/Operations.jl:1060
[3] withenv(::Pkg.Operations.var"#66#73"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec, String}, ::Pair{String, String}, ::Vararg{Pair{String}})
@ Base ./env.jl:172
[4] (::Pkg.Operations.var"#107#112"{String, Bool, Bool, Bool, Pkg.Operations.var"#66#73"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec, String}, Pkg.Types.PackageSpec})()
@ Pkg.Operations /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/Operations.jl:1619
[5] with_temp_env(fn::Pkg.Operations.var"#107#112"{String, Bool, Bool, Bool, Pkg.Operations.var"#66#73"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec, String}, Pkg.Types.PackageSpec}, temp_env::String)
@ Pkg.Operations /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/Operations.jl:1493
[6] (::Pkg.Operations.var"#105#110"{Dict{String, Any}, Bool, Bool, Bool, Pkg.Operations.var"#66#73"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec, String}, Pkg.Types.Context, Pkg.Types.PackageSpec, String, Pkg.Types.Project, String})(tmp::String)
@ Pkg.Operations /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/Operations.jl:1582
[7] mktempdir(fn::Pkg.Operations.var"#105#110"{Dict{String, Any}, Bool, Bool, Bool, Pkg.Operations.var"#66#73"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec, String}, Pkg.Types.Context, Pkg.Types.PackageSpec, String, Pkg.Types.Project, String}, parent::String; prefix::String)
@ Base.Filesystem ./file.jl:764
[8] mktempdir(fn::Function, parent::String) (repeats 2 times)
@ Base.Filesystem ./file.jl:760
[9] sandbox(fn::Function, ctx::Pkg.Types.Context, target::Pkg.Types.PackageSpec, target_path::String, sandbox_path::String, sandbox_project_override::Pkg.Types.Project; preferences::Dict{String, Any}, force_latest_compatible_version::Bool, allow_earlier_backwards_compatible_versions::Bool, allow_reresolve::Bool)
@ Pkg.Operations /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/Operations.jl:1540
[10] build_versions(ctx::Pkg.Types.Context, uuids::Set{Base.UUID}; verbose::Bool)
@ Pkg.Operations /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/Operations.jl:1041
[11] build_versions
@ /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/Operations.jl:956 [inlined]
[12] add(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}, new_git::Set{Base.UUID}; preserve::Pkg.Types.PreserveLevel, platform::Base.BinaryPlatforms.Platform)
@ Pkg.Operations /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/Operations.jl:1286
[13] add(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; preserve::Pkg.Types.PreserveLevel, platform::Base.BinaryPlatforms.Platform, kwargs::Base.Pairs{Symbol, IJulia.IJuliaStdio{Base.PipeEndpoint}, Tuple{Symbol}, NamedTuple{(:io,), Tuple{IJulia.IJuliaStdio{Base.PipeEndpoint}}}})
@ Pkg.API /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/API.jl:275
[14] add(pkgs::Vector{Pkg.Types.PackageSpec}; io::IJulia.IJuliaStdio{Base.PipeEndpoint}, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ Pkg.API /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/API.jl:156
[15] add(pkgs::Vector{Pkg.Types.PackageSpec})
@ Pkg.API /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/API.jl:145
[16] #add#27
@ /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/API.jl:144 [inlined]
[17] add
@ /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/API.jl:144 [inlined]
[18] #add#26
@ /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/API.jl:143 [inlined]
[19] add(pkg::String)
@ Pkg.API /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/API.jl:143
[20] top-level scope
@ In[37]:1
Now, we can put this together:
$\frac{1}{|G|} \sum_{g \in G}|X^g| = \frac{8! / 2^4 + 4! + 8 * 4!}{ 16} = 2736 / 16 = 171$
So, $\frac{1}{|G|} \sum_{g \in G}|X^g| = 2736 / 16 = 171$
This corresponds to our brute-force solution.
using Graphs, GraphPlot
using Compose, Cairo, Fontconfig
using Colors
g = SimpleGraph(8)
for i in 1:7
add_edge!(g, i, i + 1)
end
#add_edge!(g, 8, 1)
nodelabel = fill("", length(8))
membership = [1, 2, 3, 4, 1, 2, 3, 4]
nodecolor = [colorant"red", colorant"blue", colorant"yellow", colorant"green"]
# membership color
nodefillc = nodecolor[membership]
locs_x = [0, 2, 3, 2]
locs_y = [0, -1, 1, 0]
nodestrokelw = [0, 0, 0, 0, 0]
g = gplot(g, nodefillc=nodefillc)#, locs_x, locs_y, #nodelabel=nodelabel,
#nodestrokec = "black", nodestrokelw = nodestrokelw, NODESIZE = .15)
draw(PNG("smoking.png", 16cm, 16cm),g)
g
<svg xmlns=“http://www.w3.org/2000/svg" xmlns:xlink=“http://www.w3.org/1999/xlink" version=“1.2” width=“141.42mm” height=“100mm” viewBox=“0 0 141.42 100” stroke=“none” fill="#000000” stroke-width=“0.3” font-size=“3.88”
id="img-a1fe2ea6">
]]>
import Pkg; Pkg.add("Colors")
[32m[1m Resolving[22m[39m package versions...
[32m[1m Updating[22m[39m `~/.julia/environments/v1.8/Project.toml`
[90m [5ae59095] [39m[92m+ Colors v0.12.10[39m
[32m[1m No Changes[22m[39m to `~/.julia/environments/v1.8/Manifest.toml`
factorial(8) / 2^4 + factorial(4) * 9
2736.0
using Combinatorics
all_permutations = permutations(["r", "r", "g", "g", "b", "b"], 6)
Combinatorics.Permutations{Vector{String}}(["r", "r", "g", "g", "b", "b"], 6)
all_perms_list
720-element Vector{Vector{String}}:
["r", "r", "g", "g", "b", "b"]
["r", "r", "g", "g", "b", "b"]
["r", "r", "g", "b", "g", "b"]
["r", "r", "g", "b", "b", "g"]
["r", "r", "g", "b", "g", "b"]
["r", "r", "g", "b", "b", "g"]
["r", "r", "g", "g", "b", "b"]
["r", "r", "g", "g", "b", "b"]
["r", "r", "g", "b", "g", "b"]
["r", "r", "g", "b", "b", "g"]
["r", "r", "g", "b", "g", "b"]
["r", "r", "g", "b", "b", "g"]
["r", "r", "b", "g", "g", "b"]
⋮
["b", "b", "g", "r", "r", "g"]
["b", "b", "g", "r", "g", "r"]
["b", "b", "g", "r", "r", "g"]
["b", "b", "g", "r", "g", "r"]
["b", "b", "g", "g", "r", "r"]
["b", "b", "g", "g", "r", "r"]
["b", "b", "g", "r", "r", "g"]
["b", "b", "g", "r", "g", "r"]
["b", "b", "g", "r", "r", "g"]
["b", "b", "g", "r", "g", "r"]
["b", "b", "g", "g", "r", "r"]
["b", "b", "g", "g", "r", "r"]
keep_list_symmetry = [join(x) for x in keep_list]
48-element Vector{String}:
"rrggbb"
"rrgbgb"
"rrgbbg"
"rrbggb"
"rrbgbg"
"rrbbgg"
"rgrgbb"
"rgrbgb"
"rgrbbg"
"rggrbb"
"rggbrb"
"rggbbr"
"rgbrgb"
⋮
"grbbrg"
"ggrrbb"
"ggrbrb"
"ggbrrb"
"gbrrgb"
"gbrrbg"
"gbrgrb"
"gbgrrb"
"brrggb"
"brgrgb"
"brggrb"
"bgrrgb"
all_perms_list = collect(permutations(["r", "r", "g", "g", "b", "b"], 6))
keep_list = []
for i in 2:length(all_perms_list)
already_in_list = false
for j in 1:length(keep_list)
if is_equivalent(all_perms_list[i], keep_list[j])
already_in_list = true
end
end
if !already_in_list
push!(keep_list, all_perms_list[i])
end
end
print(length(keep_list))
90
keep_list_no_symmetry = [join(x) for x in keep_list]
90-element Vector{String}:
"rrggbb"
"rrgbgb"
"rrgbbg"
"rrbggb"
"rrbgbg"
"rrbbgg"
"rgrgbb"
"rgrbgb"
"rgrbbg"
"rggrbb"
"rggbrb"
"rggbbr"
"rgbrgb"
⋮
"bggrrb"
"bggrbr"
"bggbrr"
"bgbrrg"
"bgbrgr"
"bgbgrr"
"bbrrgg"
"bbrgrg"
"bbrggr"
"bbgrrg"
"bbgrgr"
"bbggrr"
double_counted_list = []
for x in keep_list_no_symmetry
if !(x in keep_list_symmetry)
push!(double_counted_list, x)
end
end
single_counted_list = []
for x in keep_list_symmetry
if !(reverse(x) in double_counted_list)
push!(single_counted_list, x)
end
end
single_counted_list
6-element Vector{Any}:
"rgbbgr"
"rbggbr"
"grbbrg"
"gbrrbg"
"brggrb"
"bgrrgb"
reverse("rrbbgg") in keep_list_symmetry
false
reverse("rrbbgg")
"ggbbrr"
factorial(6) / factorial(4) / factorial(2) * factorial(4) / factorial(2) / 2
90.0
using Combinatorics
all_permutations = permutations(["a", "a", "b", "b", "c", "c", "d", "d"], 8)
Combinatorics.Permutations{Vector{String}}(["a", "a", "b", "b", "c", "c", "d", "d"], 8)
using Combinatorics
all_permutations = permutations(["a", "a", "b", "b", "c", "c", "d", "d", "e", "e"], 10)
Combinatorics.Permutations{Vector{String}}(["a", "a", "b", "b", "c", "c", "d", "d", "e", "e"], 10)
all_perms_list = collect(all_permutations)
3628800-element Vector{Vector{String}}:
["a", "a", "b", "b", "c", "c", "d", "d", "e", "e"]
["a", "a", "b", "b", "c", "c", "d", "d", "e", "e"]
["a", "a", "b", "b", "c", "c", "d", "e", "d", "e"]
["a", "a", "b", "b", "c", "c", "d", "e", "e", "d"]
["a", "a", "b", "b", "c", "c", "d", "e", "d", "e"]
["a", "a", "b", "b", "c", "c", "d", "e", "e", "d"]
["a", "a", "b", "b", "c", "c", "d", "d", "e", "e"]
["a", "a", "b", "b", "c", "c", "d", "d", "e", "e"]
["a", "a", "b", "b", "c", "c", "d", "e", "d", "e"]
["a", "a", "b", "b", "c", "c", "d", "e", "e", "d"]
["a", "a", "b", "b", "c", "c", "d", "e", "d", "e"]
["a", "a", "b", "b", "c", "c", "d", "e", "e", "d"]
["a", "a", "b", "b", "c", "c", "e", "d", "d", "e"]
⋮
["e", "e", "d", "d", "c", "c", "b", "a", "a", "b"]
["e", "e", "d", "d", "c", "c", "b", "a", "b", "a"]
["e", "e", "d", "d", "c", "c", "b", "a", "a", "b"]
["e", "e", "d", "d", "c", "c", "b", "a", "b", "a"]
["e", "e", "d", "d", "c", "c", "b", "b", "a", "a"]
["e", "e", "d", "d", "c", "c", "b", "b", "a", "a"]
["e", "e", "d", "d", "c", "c", "b", "a", "a", "b"]
["e", "e", "d", "d", "c", "c", "b", "a", "b", "a"]
["e", "e", "d", "d", "c", "c", "b", "a", "a", "b"]
["e", "e", "d", "d", "c", "c", "b", "a", "b", "a"]
["e", "e", "d", "d", "c", "c", "b", "b", "a", "a"]
["e", "e", "d", "d", "c", "c", "b", "b", "a", "a"]
keep_list = [all_perms_list[1]]
1-element Vector{Vector{String}}:
["a", "a", "b", "b", "c", "c", "d", "d", "e", "e"]
for i in 2:length(all_perms_list)
already_in_list = false
for j in 1:length(keep_list)
if is_symmetrically_equivalent(all_perms_list[i], keep_list[j])
already_in_list = true
end
end
if !already_in_list
push!(keep_list, all_perms_list[i])
end
end
keep_list
["r", "g", "g", "b", "r", "b"] ?rbrggb
"r", "g", "b", "r", "b", "g"]
["r", "g", "b", "g", "r", "b"] ?rbrgbg
171 / 3
57.0
is_symmetrically_equivalent(all_perms_list[i], keep_list[j])
reverse(a)
8-element Vector{String}:
"d"
"d"
"c"
"c"
"b"
"b"
"a"
"a"
a_temp = push!(a[2:8], a[1])
8-element Vector{String}:
"a"
"b"
"b"
"c"
"c"
"d"
"d"
"a"
a[2:8] + a[1]
MethodError: no method matching +(::Vector{String}, ::String)
Closest candidates are:
+(::Any, ::Any, ::Any, ::Any...) at operators.jl:591
+(::Array, ::Array...) at arraymath.jl:12
+(::Array, ::SparseArrays.AbstractSparseMatrixCSC) at /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/SparseArrays/src/sparsematrix.jl:1833
...
Stacktrace:
[1] top-level scope
@ In[31]:1
x = true
true
reverse(a)
8-element Vector{String}:
"d"
"d"
"c"
"c"
"b"
"b"
"a"
"a"
import Pkg; Pkg.add("Primes")
[32m[1m Updating[22m[39m registry at `~/.julia/registries/General.toml`
[32m[1m Resolving[22m[39m package versions...
[32m[1m Updating[22m[39m `~/.julia/environments/v1.8/Project.toml`
[90m [27ebfcd6] [39m[92m+ Primes v0.5.3[39m
[32m[1m No Changes[22m[39m to `~/.julia/environments/v1.8/Manifest.toml`
using Primes
my_factor = Set([i[1] for i in collect(factor(18))])
Set{Int64} with 2 elements:
2
3
length(union!(my_factor, [3, 2, 5]))
3
my_factor
UndefVarError: set not defined
Stacktrace:
[1] top-level scope
@ In[23]:1
?factor
search: [0m[1mf[22m[0m[1ma[22m[0m[1mc[22m[0m[1mt[22m[0m[1mo[22m[0m[1mr[22m [0m[1mf[22m[0m[1ma[22m[0m[1mc[22m[0m[1mt[22m[0m[1mo[22m[0m[1mr[22mial my_[0m[1mf[22m[0m[1ma[22m[0m[1mc[22m[0m[1mt[22m[0m[1mo[22m[0m[1mr[22m each[0m[1mf[22m[0m[1ma[22m[0m[1mc[22m[0m[1mt[22m[0m[1mo[22m[0m[1mr[22m prod[0m[1mf[22m[0m[1ma[22m[0m[1mc[22m[0m[1mt[22m[0m[1mo[22m[0m[1mr[22ms Task[0m[1mF[22m[0m[1ma[22miledEx[0m[1mc[22mep[0m[1mt[22mi[0m[1mo[22mn
factor(n::Integer) -> Primes.Factorization
Compute the prime factorization of an integer n. The returned object, of type Factorization, is an associative container whose keys correspond to the factors, in sorted order. The value associated with each key indicates the multiplicity (i.e. the number of times the factor appears in the factorization).
julia> factor(100)
2^2 ⋅ 5^2
For convenience, a negative number n is factored as -1*(-n) (i.e. -1 is considered to be a factor), and 0 is factored as 0^1:
julia> factor(-9)
-1 ⋅ 3^2
julia> factor(0)
0
julia> collect(factor(0))
1-element Array{Pair{Int64,Int64},1}:
0=>1
factor(ContainerType, n::Integer) -> ContainerType
Return the factorization of n stored in a ContainerType, which must be a subtype of AbstractDict or AbstractArray, a Set, or an BitSet.
julia> factor(DataStructures.SortedDict, 100)
DataStructures.SortedDict{Int64,Int64,Base.Order.ForwardOrdering} with 2 entries:
2 => 2
5 => 2
When ContainerType <: AbstractArray, this returns the list of all prime factors of n with multiplicities, in sorted order.
julia> factor(Vector, 100)
4-element Array{Int64,1}:
2
2
5
5
julia> prod(factor(Vector, 100)) == 100
true
When ContainerType == Set, this returns the distinct prime factors as a set.
julia> factor(Set, 100)
Set([2,5])
using Primes
function is_relative_prime(x, y)
x_factors = factor(Set, x)
y_factors = factor(Set,y)
for factor in y_factors
if factor in x_factors
return false
end
end
## none of them had a match
return true
end
is_relative_prime (generic function with 1 method)
function euler_totient(x)
output_sum = 0
for i in 1:x
if is_relative_prime(i, x)
output_sum += 1
end
end
return output_sum
end
euler_totient (generic function with 1 method)
using Combinatorics
function get_factors(x)
prime_factors = factor(Vector, x)
all_prime_factors = vcat(prime_factors, fill(1, length(prime_factors))) ## add 1s so smaller numbers are included
factor_list = [prod(i) for i in combinations(all_prime_factors, length(prime_factors))]
return Set(factor_list)
end
get_factors (generic function with 1 method)
get_factors(12)
Set{Int64} with 6 elements:
12
1
4
6
2
3
num_beads = 4
necklace_size = 4
sum = 0
for d in get_factors(num_beads)
sum = sum + euler_totient(d) * necklace_size ^ (num_beads / d)
end
sum = sum / num_beads
print(sum)
70.0
function get_number_necklaces(n, k)
sum = 0
for d in get_factors(n)
sum = sum + euler_totient(d) * k ^ (n / d)
end
sum = sum / n
end
get_number_necklaces (generic function with 1 method)
You can check your work here https://oeis.org/A000031
function get_number_bracelets(n, k)
if round(n / 2) == n / 2
return get_number_necklaces(n, k) / 2 + (k + 1) * k^(n / 2)/4
else
return get_number_necklaces(n, k) / 2 + k^((n+1) / 2)/2
end
end
get_number_bracelets (generic function with 1 method)
get_number_necklaces(12, 2)
352.0
for i in 1:12
println(get_number_necklaces(i, 12))
end
12.0
78.0
584.0
5226.0
49776.0
498004.0
5.11884e6
5.3750346e7
5.7330932e8
6.191761368e9
6.7546215528e10
7.43008623292e11
(get_number_bracelets(8, 4)
- 4 ### bracelets of all of each of the 4 colors
- 6 * get_number_bracelets(8, 2)
- 4 * get_number_bracelets(8, 3)
)
2259.0
get_number_bracelets(5, 2)
8.0
tril!(prime_factors * transpose(prime_factors))
UndefVarError: tril! not defined
Stacktrace:
[1] top-level scope
@ In[78]:1
Burnside’s lemma takes into account rotations, and it also works for reflections.
(factorial(8) / (2 ^ 4) + factorial(4) * 9) / 16
171.0
(factorial(6) / (2 ^ 3) + factorial(3) * 7) / 12
11.0
24 * 171 - factorial(8) / (2 ^ 4) - factorial(4) * 17 * 3
360.0
factor(Vector, 1992)
5-element Vector{Int64}:
2
2
2
3
83
?combinations
search: [0m[1mc[22m[0m[1mo[22m[0m[1mm[22m[0m[1mb[22m[0m[1mi[22m[0m[1mn[22m[0m[1ma[22m[0m[1mt[22m[0m[1mi[22m[0m[1mo[22m[0m[1mn[22m[0m[1ms[22m all_[0m[1mc[22m[0m[1mo[22m[0m[1mm[22m[0m[1mb[22m[0m[1mi[22m[0m[1mn[22m[0m[1ma[22m[0m[1mt[22m[0m[1mi[22m[0m[1mo[22m[0m[1mn[22m[0m[1ms[22m multiset_[0m[1mc[22m[0m[1mo[22m[0m[1mm[22m[0m[1mb[22m[0m[1mi[22m[0m[1mn[22m[0m[1ma[22m[0m[1mt[22m[0m[1mi[22m[0m[1mo[22m[0m[1mn[22m[0m[1ms[22m [0m[1mC[22m[0m[1mo[22molLexCo[0m[1mm[22m[0m[1mb[22m[0m[1mi[22m[0m[1mn[22m[0m[1ma[22m[0m[1mt[22m[0m[1mi[22m[0m[1mo[22m[0m[1mn[22m[0m[1ms[22m
combinations(a, n)
Generate all combinations of n elements from an indexable object a. Because the number of combinations can be very large, this function returns an iterator object. Use collect(combinations(a, n)) to get an array of all combinations.
combinations(a)
Generate combinations of the elements of a of all orders. Chaining of order iterators is eager, but the sequence at each order is lazy.
factorial(14) / factorial(14 - 6) / factorial(6) * factorial(8) / factorial(5) / factorial(3)
168168.0
factorial(14) / factorial(14 - 3) / factorial(3) * factorial(11) / factorial(6) / factorial(5)
168168.0
factorial(8) / 2 ^4
2520.0
factorial(8) / factorial(6) * factorial(6) / factorial(4) * factorial(4) / factorial(2) / 2^3
2520.0
1: 1
2: 6
3: 19
4: 43
5: 66
6: 80
7: 66
8: 43
9: 19
10: 6
11: 1
12: 1
(1 + 6 + 19 + 43 + 66) * 2 + 80 + 1
351
function comb(n, k)
return factorial(n) / factorial(k) / factorial(n - k)
end
comb (generic function with 1 method)
## 2/10
(comb(12, 2) + 6)/ 12 # at 6 o clock, there are 6 different fixed points
## 3 / 9
(comb(12, 3) + 4*2)/ 12
## 4 and 8 o clock both have 4 fixed
19.0
## 4/8
(comb(12, 4) +
comb(6, 2) + #rotation at half
3*2 #at 3 and 9 o clock there are 3 possible combinations
)/ 12
43.0
## 5/7
(comb(12, 5))/ 12 ## no way for there to be any fixed points beyond the null
66.0
comb(12, 6) / 12
77.0
## 6
(comb(12, 6) +
2 * 2 + #2, and 10 o clock both have 2 choices
comb(4, 2) * 2 + #4 and 8 o clock rotations can distribute 1/3 the beads (2) among 4 possible slots
comb(6, 3) # 6 o clock can distribute 3 beads among 6 possible slots
)/ 12
80.0
sum = 0 ## chord of 1
for i in 1:12
current_number = factorial(11) / factorial(i - 1) / factorial(11 - i + 1)
sum += current_number
println(i, " ", current_number)
end
print(sum)
1 1.0
2 11.0
3 55.0
4 165.0
5 330.0
6 462.0
7 462.0
8 330.0
9 165.0
10 55.0
11 11.0
12 1.0
2048.0
If there were 4 different notes
0. 1 option
get_number_necklaces(4, 2)
6.0
If there were 5 notes:
get_number_necklaces(5, 2)
8.0
using Combinatorics
n_played = 1
n_notes = 12
perms = permutations(
vcat(repeat([true], n_played), repeat([false], n_notes - n_played)),
n_notes)
Combinatorics.Permutations{Vector{Bool}}(Bool[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 12)
length(perms)
479001600
output_list = []
for arrangement in perms
if !( arrangement in output_list)
push!(output_list, arrangement)
end
end
output_list
12-element Vector{Any}:
Bool[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
Bool[0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
Bool[0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0]
Bool[0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0]
Bool[0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0]
Bool[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0]
Bool[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0]
Bool[0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0]
Bool[0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0]
Bool[0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0]
Bool[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0]
Bool[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]
collect(combinations([1, 2, 3], 3))
1-element Vector{Vector{Int64}}:
[1, 2, 3]
function get_all_perms_list(n_played, n_notes = 12)
perms = permutations(
vcat(repeat([true], n_played - 1), repeat([false], n_notes - n_played)),
n_notes - 1)
output_list = []
for arrangement in perms
if !( arrangement in output_list)
push!(output_list, arrangement)
end
end
for i in 1:length(output_list)
push!(output_list[i], true) #endlways end with a note played
end
return output_list
end
get_all_perms_list (generic function with 2 methods)
get_all_perms_list(2, 5)
4-element Vector{Any}:
Bool[1, 0, 0, 0, 1]
Bool[0, 1, 0, 0, 1]
Bool[0, 0, 1, 0, 1]
Bool[0, 0, 0, 1, 1]
using Combinatorics
function get_num_note_combinations(n_played)
all_perms_list = get_all_perms_list(n_played)
keep_list = []
for i in 2:length(all_perms_list)
already_in_list = false
for j in 1:length(keep_list)
if is_rotationally_equivalent(all_perms_list[i], keep_list[j])
already_in_list = true
end
end
if !already_in_list
push!(keep_list, all_perms_list[i])
end
end
println(n_played, ": ", length(keep_list))
end
get_num_note_combinations (generic function with 1 method)
for i in 2:12
get_num_note_combinations(i)
end
2: 6
3: 19
4: 43
5: 66
6: 80
7: 66
8: 43
9: 19
InterruptException:
Stacktrace:
[1] copy
@ ./array.jl:369 [inlined]
[2] nextpermutation(m::Vector{Bool}, t::Int64, state::Vector{Int64})
@ Combinatorics ~/.julia/packages/Combinatorics/Udg6X/src/permutations.jl:53
[3] iterate
@ ~/.julia/packages/Combinatorics/Udg6X/src/permutations.jl:44 [inlined]
[4] get_all_perms_list(n_played::Int64, n_notes::Int64)
@ Main ./In[42]:11
[5] get_all_perms_list
@ ./In[42]:2 [inlined]
[6] get_num_note_combinations(n_played::Int64)
@ Main ./In[44]:3
[7] top-level scope
@ ./In[45]:2