This file contains hidden or 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 System.IO | |
main = do | |
putStrLn $ biggest "0" [ show (a*b) | a <- [100..999], b <- [100..999], isPalindromicNum (show (a*b))] | |
isPalindromicNum [] = True | |
isPalindromicNum (_:[]) = True | |
isPalindromicNum (x:xs) | x == last xs = isPalindromicNum (init xs) | |
| otherwise = False |
This file contains hidden or 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 System.IO | |
main = do | |
putStrLn $ show $ last $ filter ((== 0) . (mod 600851475143)) (takeWhile (< (truncate (sqrt 600851475143))) prime) | |
prime = 2:f [3] [3,5..] | |
where f (x:xs) ys = let (ps, qs) = span (< x^2) ys | |
in ps ++ f (xs ++ ps) [z | z <- qs, z `mod` x /= 0] |
This file contains hidden or 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 System.IO | |
main = do | |
putStrLn $ show $ sum $ filter even $ takeWhile ((>) 4000000) fib | |
fib = 1:2:[ a+b | (a,b) <- zip fib (tail fib)] |
This file contains hidden or 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 System.IO | |
main = do | |
putStrLn $ show $ sum $ filter judge [1..999] | |
judge a | a `mod` 3 == 0 || a `mod` 5 == 0 = True | |
| otherwise = False |
This file contains hidden or 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
#include <stdio.h> | |
int main(void){ | |
printf("Hello World!\n"); //this is a test | |
} |
NewerOlder