2017-02-19から1日間の記事一覧

自然数から平方数を取り除いた数列の N 番目を求める

A000037 - OEIS の式を使って求めます。 ; https://oeis.org/A000037 (define (f n) (+ n (exact-integer-sqrt (+ n (exact-integer-sqrt n))))) 実行結果です。 % gosh -l ./not-square-numbers.scm gosh> (map f (iota 100 1)) (2 3 5 6 7 8 10 11 12 13 1…