misc: add more scripts
This commit is contained in:
14
misc/Nolindrom.hs
Normal file
14
misc/Nolindrom.hs
Normal file
@@ -0,0 +1,14 @@
|
||||
module Nolindrom where
|
||||
|
||||
nolindrom :: Int -> Integer -> Bool
|
||||
nolindrom i n
|
||||
| i >= 100 = True
|
||||
| otherwise =
|
||||
let r = read . reverse . show $ n
|
||||
n' = r + n
|
||||
in not (palindrome n') && nolindrom (succ i) n'
|
||||
where
|
||||
palindrome x =
|
||||
let s = show x
|
||||
in s == reverse s
|
||||
|
||||
Reference in New Issue
Block a user