We have the task to build a simple recursive function displaying the Mersenne number in Haskell, sorted from smallest to biggest number.
It's basicly 2^n-1
So mersenne 7 looks something like that [0,1,3, 7, 15, 31, 63]
We couldn't get it done sadly and are stuck on that piece of code.
mrs :: Integer -> [Integer]
mrs 1 = [0]
mrs n = n : mrs (2^(n-1)-1)
But somehow the numbers are increasing in size while they should decrease because n is getting lower. I believe it's easy to solve and I'll feel dumb afterwards, but so be it.
Currently, for input 7 it spits out [7, 63, 46.........giant number, error]
For input 3 it constantly spits out 3's: [3,3,3,3...] and lower than that tells me about negativ exponents.
We are quite new to Haskell, all googling and reading through scripts didn't work.