 = n
where 
    n = count 1
        where
            count :: Integer -> Integer
            count 1000000 = 1000000
            count n = count (n+1)

My train of thought is that count will increase by one each time, and the expression will be checked, but apparently it goes all the way up to 1000000 (which is just a roof value)

A: I would write is slightly different
search a k m = go 1
      where go 10000 = 10000
            go n     = if ((n+a)^k < m^n) then n else go (n+1)

testing with 
search 2 3 4

returns 
4


A: I'd use the filter and minimum combinators from Data.List like so:
import Data.List

search :: Int -> Int -> Int -> Int
search a k m =
  minimum $ filter (\n -> (n+a)^k < m^n) [1.. 1000000]
  -- filter picks out the n that satisfy the inequality and minimum gives you the minimum

---- Update based on comments received:
The problem with search as defined above is that it will throw an exception if there are no solutions in the range 1.. 1000000.
A safer way of writing search (i.e without throwing exceptions) would be to use Maybe to encode the possibility of there being no solutions in the given range. Something like:
safeSearch :: Int -> Int -> Int -> Int -> Maybe Int
safeSearch a k m roof =
  let
    solutions = filter (\n -> (n+a)^k < m^n) [1.. roof]
  in
    case solutions of 
      [] -> Nothing
      _  -> Just $ head solutions

After watching the film Limitless, I fantasized what it would be like to take a real version of NZT-48 to optimize my brain function. We already know that we can enhance our noggin’s performance by multiple lifestyle methods and techniques such as deep sleep, meditation, nutrient-rich foods, and particular supplemental agents. But what about total brain access with one easy pill? Like Bradley Cooper’s character in Limitless, I thought enhancing my memory, intelligence, and concentration was a tantalizing notion. Finally I’d have more energy and edge to excel in this fast-paced, data-driven matrix. A few months ago, while telling a friend about my never-ending juggling of tasks, she informed me that there was indeed a real-life limitless drug called Provigil (Modafinal). You need a prescription, and without insurance the cost of Modafinil can be as high as $50 for a single 200 mg pill. Provigil was initially created to treat narcolepsy and other sleep disorders like sleep apnea, and shift-work sleep disorder, but off-label use has skyrocketed by about 74 percent in recent years, coinciding with the release of Limitless. “The drug has been under patent by the French pharmaceutical company Cephalon (formerly Lafon) since the late 1990s,” according to nootriment.com. Devoted to the story and reaching the apex of my intelligence, I made a note to self to call a Dr. FeelGood in Beverly Hills; besides my sleep was shoddy. And then, I ordered Modanfinal online from a supposedly reliable source in India. I have tracking on the package, but it has yet not arrived. Modafinal, however, is not the only smart pill; it turns out there’s an entire market of similar pills called nootropics. According to Google trends, searches for ‘nootropics’ have also been rising in popularity since early 2011. Many nootropics companies directly reference the movie Limitless in their branding. In 2015, sales of nootropics exceeded $1 billion in the United States alone, and the global demand is still growing rapidly. The brain is the next frontier for the tech sector. Apparently, Silicon Valley and Wall Street execs, serious students, athletes, and super achievers like Tim Ferris and Dave Asprey are devotees. And according to Ryan Ballow, founder and CEO of LiveCortex, his nootropic (and only his) is being tested and used on soldiers in the United States Army. Online dating expert Radio Wright swears by them. The 35-year-old, who has ADD, takes a nootropic called Trubrain to help him focus. He prefers them over prescription medications like Adderol because there are no unpleasant side effects. “This just makes my brain work better, and I saw an immediate response.” Meanwhile Conor Keenan, a Digital Marketing Manager, says nootropics are what allow him to “think clearer, faster, and be more innovative” for his company. He turned to Trubrain after experimenting with other cheaper brands that weren’t as effective. And finally, Ballow claims nootropics helped him build two successful national companies as well as recover from PTSD after serving in the Iraq War. His flagship product aims to improve the brain’s capacity to form cell membranes. According to Ballow, most other nootropics don’t target neuronal growth.
Hacking The Brain: Fact or Fiction?
The concept behind nootropics is “to target some metabolic or nutritional aspect of brain function, especially one that involves memory or attention, and then to provide a nutritional precursor to that metabolic pathway, or a drug that enhances the activity of a neurotransmitter, enzyme, or other metabolic factor.” Pinpointing a singular way to enhance brain function – or even narrowing it down to a few – is quite hard, given the sheer complexity of the human mind. Yet in the past couple of decades, says Eftang, the advancements made in understanding the human brain have been staggering. For instance, we’ve learned that the NMDA and AMPA receptors are the major players for controlling synaptic plasticity and memory functions in the hippocampus, and that many ingredients in nootropics work by increasing the signal strength and quantity of dopamine and acetylcholine (both of which are neurotransmitters involved in focus, memory, verbal fluency, and motivation). But because the brain is so complex and the equipment used to study it is very new, we still do not know exactly how nootropics work, says David Taylor Founder and CEO of MobiusNutrition.com. However, we know that “they do work, based on data from clinical studies.” But do they really work? Until I find my own limitless drug and write a follow-up, the biggest issue people have, says Eftang, with getting a correct answer to that question is the oversimplification of our understanding of human cognition, It’s important to understand that some nootropics work on different pathways and mechanisms in the brain, and that everyone’s brain chemistry is different. Several people I interviewed cautioned that what works for one person may do nothing for another. “It’s a process of researching and understanding the mechanisms involved, and what works best for your own brain chemistry,” explains Eftang. “Also, not every compound out there is going to give as strong or immediate effects as prescription stimulants like Adderall or Ritalin. Anyone that tells you X compound will for sure give you Y effect is lying. There is a lot of trial and error involved,” says Eftang. 3 Tips To Consider When Taking Nootropics Brandon Mentore, a Functional Medicine Practitioner and Sports Nutritionist, suggests people experiment with nootropics as stand-alone ingredients or in compounds or formulations that have several known nootropic agents. Here are three of his tips.
It’s important to do your research so you can discover important details about each compound you wish to try. For example, taking Alpha-GPC, a natural choline compound found in the brain, in the evening can give you nightmares or make sleeping difficult. MCT (from medium chain triglycerides) needs to be taken slowly, or it can result in gastric distress.
Understand what your goal is and what you would like to accomplish, and understand that everyone reacts differently.If you don’t notice any effects from a certain product or ingredient, you may have to try something different.
More isn’t necessarily better. It’s important to realize that the brain is very similar to an engine in a car, and you can’t constantly push it. The more you drive the brain, the more it needs to recover, recharge, and restore through sleep, hydration, and stress management.
Read Next: 10 Ways CBD Can Change Lives. Find out why executives, athletes and doctors rave about CBD.
Best natural nootropic product: Huperzine A, extract from the Chinese club moss Huperzia serrata.
It’s a fair question, and some of them don’t come without potential side effects. You have to understand your own brain, how certain nootropics effect you, and what to do in the case of anxiety. A good example might be to keep some L-theanine around, an amino acid that calms the brain and induces alpha brain wave states, in case you feel some anxiety coming along.
For some, just ensuring you’ve got sufficient B vitamins prevent side effects.  It behooves one to do the research on which neurotransmitters you’ll be effecting by taking certain compounds.
But, caffeine, has side effects. And what’s the number 1 side effect of caffeine? Anxiety. So – keep nootropics relative to things like this. Alcohol as well. Even though they’re vastly different, these are mainstream compounds that people consume relatively safely, everyday, but that do create side effects if you’re not careful.
Very interesting topic! I have considered trying nootrop