bjorng
Erlang Core Team
This topic is about Day 6 of the Advent of Code 2021.
We have a private leaderboard (shared with users of Erlang Forums ):
https://adventofcode.com/2021/leaderboard/private/view/370884
The entry code is:
370884-a6a71927
Trending in Challenges
Other Trending Topics
Edit: 2026 May 15 - This post is archived.
Mob is alive!!
Main docs: mob v0.7.11 — Documentation
A bit of explanation for the slightly c...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
A little off-topic, but I feel like people here have a good head on their shoulders.
I used to be quite good at making software. Was luc...
New
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ai
- #ecto-query
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #metaprogramming
- #hex










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
bjorng
Here is my solution:
https://github.com/bjorng/advent-of-code-2021/blob/2605f7079c9cb7350daa5ba7cc13a84dd3e439b7/day06/lib/day06.ex
rugyoga
https://github.com/rugyoga/aoc2021/blob/main/day6.exs
ruslandoga
I went with representing the frequencies as a tuple and a simulation step was:
Full solution
It’d be nice to see an Nx solution here, it fits this problem very nicely.
princemaple
https://github.com/princemaple/aoc/blob/main/2021/day6.exs
code-shoily
I did it the “slow” way the first time and got instant gratification, the later part, not so instant (in fact not all) until I remembered bucket sort
and my good old friends
Enum.frequenciesandMap.merge/3Here’s how the end product looked like:
stevensonmt
struggling with the size of part 2. I want to do this in a mathematical way following an exponential growth equation like
number of fishes * (1 + rate of growth)^number of daysbut this doesn’t work.wasi0013
I enjoyed this one!
code-shoily
I wish I analyzed input properties more before jumping to solving things. The same happened with Bingo, the solution looked different in my head before and after I realized it’s a 5x5 grid all the time.
code-shoily
Looking forward to what you come up with. I was thinking the same thing but got lazy (scared) and backed away.
stevensonmt
I’m going to have to go to bed without solving it. My initial idea was
Bn= B0 x 2^KtwhereB0is the original count for each timer value.Kis 1/7 andt(for part 2) is256 - the original timer value. Just calculate that for each original timer value and then add them together. Not sure how to make it work though.DERP.
Not accounting for the maturation time with each generation.