Ad
  • Default User Avatar

    I like your solution best (dunno if it's most idiomatic, being Elixir newbie myself), it's most readable and goes the farthest (along with g964's) before it hits some Erlang integer minimum (namely, -1.797e+308) when calculating the partial sum (according to my naive test set):

    test "fortune billion years, interest 1, inflation 1" do
      assert(
        Bankerplan.fortune(100000, 1, 1000, 69525, 1) == false
      )
    end
    

    Interestingly enough, the solution using Stream gives up some ~500 years earlier :) (probably due to the suboptimal interest rate calculation)