Created
February 18, 2016 20:49
-
-
Save skylerto/d99100b601ecd481fb4d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.List | |
import System.IO | |
{- | |
- THE PROBLEM: | |
- For every real number a>1a>1 is given the sequence gaga by: | |
- ga(x)=1ga(x)=1 for x<ax<a | |
- ga(x)=ga(x−1)+ga(x−a)ga(x)=ga(x−1)+ga(x−a) for x≥ax≥a | |
- G(n)=gn√(n)G(n)=gn(n) | |
- G(90)=7564511G(90)=7564511. | |
- | |
- Find ∑G(p)∑G(p) for pp prime and 10000000<p<1001000010000000<p<10010000 | |
- Give your answer modulo 1000000007. | |
-} | |
ga :: Float -> Float -> Float | |
ga x a | |
| x < a = 1 | |
| x >= a = (ga (x-1) a) + (ga (x-a) a) | |
| otherwise = 0 | |
second :: Float -> Float | |
second n = ga n (sqrt n) | |
test = second 90 | |
list = [10000000..10010000] | |
mapList = map second list | |
solution = mod (ceiling (product mapList)) 1000000007 | |
--solution = (product (map second ) `mod` 1000000007 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment