2008-11-11から1日間の記事一覧

Problem 66

http://projecteuler.net/index.php?section=problems&id=66 とりあえず、D=61でつまった。 考える。考える。考える。 それでもD=61の解がでない。 そこで、禁断のgoogle先生。 どうやらこの問題は Pell Equationというらしい。 でmathworld。 http://mathwo…

ラムダ計算

前に作ったもの。ラムダ計算のベータ簡約をHaskellで実装。 module Lambda where import Data.List type Val = String data Lambda = V Val | A Lambda Lambda | L Val Lambda instance Show Lambda where show (V x) = x show (A m n) = show' m ++ show'' …

Problem 68

http://projecteuler.net/index.php?section=problems&id=68 とりあえず一般化してmagic nを求められるようにした。 始めはsの範囲を間違えていて正しい解が出なかった。 ちなみに重複を除くのは面倒なのでやっていない。 import Data.List import Data.Ord …