重み付きレーベンシュタイン距離(編集距離)のライブラリを書きました。文字ごとに追加・削除・置換のコストが指定できます。文字列の長さによる正規化や複数の文字列から近いものを選ぶ関数も含まれてます。
エラーメッセージをラフに分類したいという動機から作り始めました。類型的で機械学習が必須なわけでない分類タスクにお役立てください。
詳しい使い方はGitHubのREADMEを見てください。
go get -u github.com/deltam/go-lsd-parametrizedgo get -u github.com/deltam/go-lsd-parametrized| 入力1 | 入力2 | And出力 | Or出力 |
|---|---|---|---|
| a | 0 | 0 | a |
| a | 1 | a | 1 |
| a | a | a | a |
| 0 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 |
| 1 | 1 | 1 | 1 |
@deltam それを実現する段数が最小の回路をXとしましょう。いま、出力が1だとすると、出力の手前の素子Yへの入力は(Xの段数最小性より)全てゼロのはずです。するとYがANDでもORでも入力が全てゼロなら出力は決して1にならないので矛盾。
Q.E.D.
— ITコンサルタント (@chiral) 2015, 4月 19
58 is an idoneal number.
58 - Wolfram|Alpha
In mathematics, Euler's idoneal numbers (also called suitable numbers or convenient numbers) are the positive integers D such that any integer expressible in only one way as x^2 ± Dy^2 (where x^2 is relatively prime to Dy^2) is a prime, prime power, or twice one of these.(relatively prime=互いに素)
(defun idoneal (d x y)
(list (+ (* x x) (* d y y))
(- (* x x) (* d y y))))
(idoneal 58 3 2)
(241 -223) ; 241 素数
(idoneal 58 5 1)
(83 -33) ; 83 素数
(idoneal 58 5 2)
(257 -207) ; 257 素数
(idoneal 58 7 1)
(107 -9) ; 107 素数
The 65 idoneal numbers found by Carl Friedrich Gauss and Leonhard Euler and conjectured to be the only such numbers are 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13, 15, 16, 18, 21, 22, 24, 25, 28, 30, 33, 37, 40, 42, 45, 48, 57, 58, 60, 70, 72, 78, 85, 88, 93, 102, 105, 112, 120, 130, 133, 165, 168, 177, 190, 210, 232, 240, 253, 273, 280, 312, 330, 345, 357, 385, 408, 462, 520, 760, 840, 1320, 1365, and 1848 (sequence A000926 in OEIS). Weinberger proved in 1973 that at most one other idoneal number exists, and that if the generalized Riemann hypothesis holds, then the list is complete.
Idoneal number - Wikipedia, the free encyclopedia
33 is the smallest number with 9 representations as a sum of 3 primes:
33 = 2+2+29 = 3+7+23 = 3+11+19 = 3+13+17 = 5+5+23 = 5+11+17 = 7+7+19 = 7+13+13 = 11+11+11
33 - Wolfram|Alpha
33 = 1! + 2! + 3! + 4!
33 - Wikipedia
41 and 43 form a twin prime pair.
43 - Wolfram|Alpha
27 is the smallest number with 2 representations as a sum of 3 positive squares:
27 = 1^2+1^2+5^2 = 3^2+3^2+3^2
27 - Wolfram|Alpha
A regular 48-gon is constructible with straightedge and compass.
48 - Wolfram|Alpha
ガウスはさらに1801年に出版した『整数論の研究』において、正 n 角形が作図可能であるための必要十分条件が、n が2の冪と相異なるフェルマー素数の積、すなわち
n = 2^mFaFb…Fc(Fa , Fb , … ,Fc は全て異なるフェルマー素数、m は非負整数)
の形であることを示した[6]。
定規とコンパスによる作図 - Wikipedia
クリスマスというものに、最近の犀川は何も感じない。十二月二十五日だから、1、2、2、5の数字を全部足すとちょうど10になる、というくらいの印象しかない。
笑わない数学者

50 is the smallesttt number with 2 representations as a sum of 2 squares:
50 = 1^2+7^2 = 5^2+5^2
50 - Wolfram|Alpha
user> (def squares (map (fn [x] (* x x)) (range 1 10)))
#'user/squares
user> (filter (fn [[k v]] (>= (count v) 4))
(apply merge-with concat
(for [x squares, y squares :while (<= y x)] {(+ x y) [x y]})))
([65 (49 16 64 1)] [50 (25 25 49 1)] [85 (49 36 81 4)])
あれれ、85は正しいけど3番目だったみたいだ。(1,7)から(2,7)じゃなくて、(1,6)を調べれば65に行き当たってたのになー。
ということで、2通りの方法で2つの平方数の和で表せる2番めに小さい自然数は65でした(ついでに3番めは85)。37 is an irregular prime, since it divides the numerator of the Bernoulli number B_32 = -7709321041217/510.
37 - Wolfram|Alpha
ベルヌーイ数は、もともと、連続する整数のべき乗和を定式化する際に、展開係数として導入された。
(中略)
一方、日本ではベルヌーイとほぼ同時期に関孝和がべき乗和を定式化し、ベルヌーイ数を発見していた[6]。 そのため、ベルヌーイ数を関・ベルヌーイ数と書いている文献[7]もある。
ベルヌーイ数 - Wikipedia
33 repeats a single digit in base 10.
33 - Wolfram|Alpha