Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Let's see how good /prog/ really is

Name: Anonymous 2012-10-26 13:44

Can you find the smallest number that fulfills the following criteria?

1. It can only contain digits of 3, 5 and 7
2. The sum of the digits can be divided by 3, 5 and 7 without remainder
3. The number can be divided by 3, 5 and 7 without remainder

Name: Anonymous 2012-10-27 9:56

import Data.Digits

d = \z -> map ($z) (map (\x y -> mod y x == 0) [3,5,7])
f = and . map (`elem` [3,5,7]) . digits 10
g = and . d . sum . digits 10

r = head . filter (\x -> f x && g x) $ [105,315..]

main = print r

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List