Send Beginners mailing list submissions to beginners@haskell.org To subscribe or unsubscribe via the World Wide Web, visit http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners or, via email, send a message with subject or body 'help' to beginners-requ...@haskell.org
You can reach the person managing the list at beginners-ow...@haskell.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Beginners digest..." Today's Topics: 1. How can I view a digit on the N-th position of 9^(9^9) in Haskell? (Sergej KAREL) 2. Re: How can I view a digit on the N-th position of 9^(9^9) in Haskell? (Francesco Ariis) 3. Re: How can I view a digit on the N-th position of 9^(9^9) in Haskell? (Sergej KAREL) ---------------------------------------------------------------------- Message: 1 Date: Thu, 06 Jun 2019 21:06:00 +0200 (CEST) From: "Sergej KAREL" <kser...@seznam.cz> To: <beginners@haskell.org> Subject: [Haskell-beginners] How can I view a digit on the N-th position of 9^(9^9) in Haskell? Message-ID: <55T.EThB.72{hdq8EsVi.1S{m...@seznam.cz> Content-Type: text/plain; charset="utf-8" Hello, Im looking for setting up a solver for the determination of digit on N-th position of the high value number Best regards Sergej -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.haskell.org/pipermail/beginners/attachments/20190606/a761d12b/attachment-0001.html> ------------------------------ Message: 2 Date: Thu, 6 Jun 2019 22:12:56 +0200 From: Francesco Ariis <fa...@ariis.it> To: beginners@haskell.org Subject: Re: [Haskell-beginners] How can I view a digit on the N-th position of 9^(9^9) in Haskell? Message-ID: <20190606201256.os2ezycnh4qtm...@x60s.casa> Content-Type: text/plain; charset=utf-8 Hello Sergej, On Thu, Jun 06, 2019 at 09:06:00PM +0200, Sergej KAREL wrote: > Hello, > Im looking for setting up a solver for the determination of digit on N-th > position of the high value number The trick is to only take the appropriate reminder instead of the whole multiplication result. Something like: λ> myMult x y = rem (x * y) 100 λ> :t +d foldr1 foldr1 :: (a -> a -> a) -> [a] -> a λ> myPower x y = foldr1 myMult (replicate y x) λ> myPower 9 9 89 λ> 9^9 387420489 λ> myPower 9 (myPower 9 9) 89 Does this help? -F ------------------------------ Message: 3 Date: Fri, 07 Jun 2019 06:06:27 +0200 (CEST) From: "Sergej KAREL" <kser...@seznam.cz> To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell <beginners@haskell.org> Subject: Re: [Haskell-beginners] How can I view a digit on the N-th position of 9^(9^9) in Haskell? Message-ID: <ZqG.EThQ.2hrfaW{DLFy.1S{u...@seznam.cz> Content-Type: text/plain; charset="utf-8" Hello Francesco, Im total beginner. I read some books and online pages. I do not know, how to apply your rows if Im looking eg. digit on position 177486336 of the number string Sorry for asking so straightforward Sergej ---------- Původní e-mail ---------- Od: Francesco Ariis <fa...@ariis.it> Komu: beginners@haskell.org Datum: 6. 6. 2019 22:13:36 Předmět: Re: [Haskell-beginners] How can I view a digit on the N-th position of 9^(9^9) in Haskell? "Hello Sergej, On Thu, Jun 06, 2019 at 09:06:00PM +0200, Sergej KAREL wrote: > Hello, > Im looking for setting up a solver for the determination of digit on N-th > position of the high value number The trick is to only take the appropriate reminder instead of the whole multiplication result. Something like: λ> myMult x y = rem (x * y) 100 λ> :t +d foldr1 foldr1 :: (a -> a -> a) -> [a] -> a λ> myPower x y = foldr1 myMult (replicate y x) λ> myPower 9 9 89 λ> 9^9 387420489 λ> myPower 9 (myPower 9 9) 89 Does this help? -F _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners " -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.haskell.org/pipermail/beginners/attachments/20190607/17bdd3ce/attachment-0001.html> ------------------------------ Subject: Digest Footer _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners ------------------------------ End of Beginners Digest, Vol 132, Issue 1 *****************************************