@Surasanji @freemo longest holding breath
@binsrc only if your titers are up to date
@binsrc it might be unsafe to eat anti-vaxers
Python Solution: Not the best, but the best I could come up with since I already saw someone else's solution and didn't want to just copy it :(
Works now, but more like the code I didn't want to copy :)
Python Solution: Not the best, but the best I could come up with since I already saw someone else's solution and didn't want to just copy it :(
Never Mind. That doesn't work.
Python Solution: Not the best, but the best I could come up with since I already saw someone else's solution and didn't want to just copy it :(
Okay, here is a fun one. We've all seen Fibonacci sequences. But they are all played out. Let's look at a different sequence. They are called Hamming Numbers after Richard Hamming, who proposed the problem of finding computer algorithms for generating these numbers in ascending order.
For number H is equal to 2**i * 3**j * 2**k where i,k,k are all non negative.
For example
2**0 * 3**0 * 5**0 = 1
2**1 * 3**0 * 5**0 = 2
2**0 * 3**1 * 5**0 = 3
2**2 * 3**0 * 5**0 = 4
2**0 * 3**0 * 5**1 = 5
2**2 * 3**1 * 5**0 = 6
2**3 * 3**0 * 5**0 = 8
So hopefully that explains what the sequence looks like. Your challenge, if you choose to accept it is to generate the first 25 of them. An arbitrary nth one such as 1700th. And given a number X determine if it is or is not a valid hamming number.
Here is the wiki article on them:
#toyprogrammingchallenge
okay, here's a freebie!!
This problem was asked by Facebook.
Given a multiset of integers, return whether it can be partitioned into two subsets whose sums are the same.
For example, given the multiset {15, 5, 20, 10, 35, 15, 10}, it would return true, since we can split it up into {15, 5, 10, 15, 10} and {20, 35}, which both add up to 55.
Given the multiset {15, 5, 20, 10, 35}, it would return false, since we can't split it up into two subsets that add up to the same sum.
@jump_spider yes, just caught me by surprise when I ran it.
@Absinthe
Yep! Like I said, my implementation treats the board as functionally infinite as cells grow towards the borders
@jump_spider looking good. I just ran it and the output was an ever expanding board, is that what you intended or is that just how it looks as it begins to overlap in different directions?
#toyprogrammingchallenge #GameOfLife
This was a fun one! Written in Ruby, I decided on treating the board size as infinite by expanding it whenever the first or last row or column has an alive cell.
The entry file is game_of_life.rb in the root directory, and for simplicity, it just runs the "small exploder" pattern instead of taking an argument for initial state.
Okay, here is a fun one. We've all seen Fibonacci sequences. But they are all played out. Let's look at a different sequence. They are called Hamming Numbers after Richard Hamming, who proposed the problem of finding computer algorithms for generating these numbers in ascending order.
For number H is equal to 2**i * 3**j * 2**k where i,k,k are all non negative.
For example
2**0 * 3**0 * 5**0 = 1
2**1 * 3**0 * 5**0 = 2
2**0 * 3**1 * 5**0 = 3
2**2 * 3**0 * 5**0 = 4
2**0 * 3**0 * 5**1 = 5
2**2 * 3**1 * 5**0 = 6
2**3 * 3**0 * 5**0 = 8
So hopefully that explains what the sequence looks like. Your challenge, if you choose to accept it is to generate the first 25 of them. An arbitrary nth one such as 1700th. And given a number X determine if it is or is not a valid hamming number.
Here is the wiki article on them:
@notthemessiah that looks great. I may have to look into some Rust now... :)
@Absinthe Had to rewrite because I forgot an important test case. Here's snail sort in Rust... again: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=4ba0f21a08b05e70e979f855dd530117
@jump_spider that sounds about my aim
@Absinthe
Related to #toyprogrammingchallenge, I thought this was a good read!
https://jvns.ca/blog/2019/11/20/what-makes-a-programming-exercise-good/
The green faerie