1/a+1/b=1/n

ですが、b=n+b’と書き換えると

n^2がb’で割り切れることが分かる。

```import Number
import Data.List
import Data.Maybe
descending xs = and . zipWith (>=) xs \$ tail xs
succ' (n+1) xs = let (ys,z:zs) = splitAt n xs
in ys++[z+1]++zs
next n (Just xs) | descending ys = Just ys
| otherwise = Nothing
where ys = succ' n xs
p108 = Just (replicate 7 ) :  foldr1 mergeMaybe [map (next n) p108|n<-[1..7]]
where mergeMaybe (Just u:us) (Just v:vs )
| decode u == decode v = Just u : mergeMaybe us vs
| decode u < decode  v = Just u : mergeMaybe us (Just v:vs)
| decode u > decode  v = Just v : mergeMaybe (Just u:us) vs
mergeMaybe (Just u:us) (Nothing:vs) = Just u: mergeMaybe us vs
mergeMaybe (Nothing:us) (Just v:vs) = Just v: mergeMaybe us vs
mergeMaybe (Nothing:us) (Nothing:vs) = Nothing:mergeMaybe us vs
decode = product.zipWith (^) prime
where prime = take 7 primes
main = print.decode.fromJust.find over.catMaybes\$p108
where over xs = 1999 < (product.map (x->2*x+1) )xs
```

イメージとしてはハミング数と同じ。

mergeMaybeの実装に手間取った。

7>log 1999 / log 3

から