Skip to content

Instantly share code, notes, and snippets.

@yllan
Created April 15, 2014 01:16
Show Gist options
  • Select an option

  • Save yllan/10694209 to your computer and use it in GitHub Desktop.

Select an option

Save yllan/10694209 to your computer and use it in GitHub Desktop.
:m + Data.Numbers.Primes
let digitSum n = sum $ map (\x -> read [x]::Integer) $ show n
let digitRoot x | x < 10 = x | otherwise = digitRoot $ digitSum x
let holesIn (x:y:xs) | y == x + 1 = holesIn (y:xs) | otherwise = [x+1..y-1] ++ holesIn (y:xs)
let p = primes
let c = (holesIn primes)::Int
@yllan

yllan commented Apr 16, 2014

Copy link
Copy Markdown
Author

digitRoot 可用 mod 9 來做。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment