Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
a lot of people probably posted this solution when
minimum
was new to prelude, it was only added in 2015this is illogical
Applied.
if it overflows the flower will have many petals, an overflower if you will
Definitely more in the spirit of the question
I was wrong. I don't know what I meant with the second sentence (after all it's two years ago).
@muesli4, can you elaborate on conditions when you expect problems to happen for this solution?
https://downloads.haskell.org/~ghc/6.0/docs/html/base/Data.Int.html states "All arithmetic is performed modulo 2^n, where n is the number of bits in the type."
Fixed
I get it now. I had a feeling that I was missing something.
There's a good chance that I'm wrong, but have you actually given a proof that thirt will always return a number less than 100?
You have shown that the sum of the products will always be less than the original number, but what about 191. The sum of the products for 191 is equal to 100.
Trying to recognize patterns "early on" in data sets can sometimes be dangerous. Of course, "early on" is a relative term.
Experience has taught me that if you think you found a pattern, and it holds for "a lot" of inputs but fails "every now and then," you probably didn't find a pattern. Because, now you have to modify your pattern so that it holds for those inputs that failed for the previous pattern. And you're probably going to find that the new pattern eventually fails for some input. So you could modify the pattern again, but at this point you should probably realize that this new pattern has the potential to fail again at some later point. You might be inclined to belive that perhaps there is a pattern to the failure points, and you might actually find a pattern that works for "a long time."
The only way to be sure that you found an acurate pattern is to formulate a rigorous mathematical proof.
Now, I don't have the time, or mathematical background to formulate a proof for this, but I do have some comments.
You mention "valid/safe" integers. The assumed upper bound for the thirt function, as given by the problem description, is infinity (n >= 0).
No matter how many numbers you check, you can never be 100% certain that your pattern holds for all numbers in the given range.
I'm not sure what you mean by "A simple pattern from 9 to 2000." You kind of skipped over the fact that something strange happens between 99 and 100. Up until that point, you increment the argument by 1, and the result is incremented by 1. At 99 to 100, the argument is incremented by 1, but the result is decremented by 90. After every 90 increments to the agrument after that, you again need to decrement by 90. This holds true untill 999 to 1000, at which point the result is decremented by 77.
I did find something that I thought was interesting. For every input from 1 to 10,000,000 the thirt function returns a number that is less than 100. It took 7 minutes to verify this, but I have no idea if this holds true for all numbers greater than 0.
Thanks g964...:-)
Good guessing, the one stayed in the keyboard... Lots of thanks, corrected!
Sorry, I've only been coding for about six months.
I didn't want to use globals, and I didn't want to mess with class definitions, and I didn't want to open the Kernel.
I spent most of a day working on this one, and I just wanted it to pass the tests.
I was very tired.
Haskell Test Cases on line 17.
I think seriesSumAux was supposed to be seriesSumAux1
Loading more items...