pgf2.blogspot.com
nameless: 2012-10
http://pgf2.blogspot.com/2012_10_01_archive.html
Anarchy golf - FizzBuzz with Python 2.7. 実行環境用意するのがめんどかったので、 ここ( Ideone.com ). 初めてなのでやっぱり anarchy golf - FizzBuzz. 但し、3 で割り切れる場合は Fizz と出力する. 但し、5 で割り切れる場合は Buzz と出力する. 但し、3 と 5 で割り切れる場合は FizzBuzz と出力する. For x in range(1, 101): if x % 15 = 0: print 'FizzBuzz' elif x % 3 = 0: print 'Fizz' elif x % 5 = 0: print 'Buzz' else: print x. For x in range(1,101):print"%s"%(x%15. For x in range(1,101):print"%s%s"%(x%3. 0and x or' ). 範囲を 0 からにしてみたら? かわらんかった . ;-)。 Or の前の () は取れる。 かわらんし、() がとれない . 。
pgf2.blogspot.com
nameless: 2011-04
http://pgf2.blogspot.com/2011_04_01_archive.html
65339;Javaで作って学ぶ暗号技術] バイナリー・ユークリッド互除法. 9670; バイナリー・ユークリッド互除法のアルゴリズム. 9670; プログラミング (xyzzy-lisp). A, b がともに偶数なら、[gcd(a, b) = 2gcd(a/2, b/2)]. A が偶数で、b が奇数なら、[gcd(a, b) = gcd(a/2, b)]. A が奇数で、b が偶数なら、[gcd(a, b) = gcd(a, b/2)]. A, b がともに奇数なら、[a - b]は偶数になる. アルゴリズムの g は、常に 2 {n} になるため、プログラムの g-bit はアルゴリズムの g のどのビットが 1 であるかを保持するための変数としている. 65339;Javaで作って学ぶ暗号技術] ユークリッド互除法. 9670; 写経 (xyzzy-lisp). ステップごとに除数と被除数が入れ替わることが「互」除法という名前の由来とかなんとからしい。 65339;Javaで作って学ぶ暗号技術] 試行割り算法. Defun gcd-trial-division(a b) (when (.
pgf2.blogspot.com
nameless: 2014-01
http://pgf2.blogspot.com/2014_01_01_archive.html
Ducci Sequence (途中). 人にはそうしたいときだってあると思うんだ . 。 9670; Ducci Sequence. 9632; n が 2 のべき乗の場合. 9632; n が 2 のべき乗以外の場合. 有限回の再帰の中で周期性を持つようになる(元がすべて 0 になることはない). 9671; プログラム (Common Lisp系). N は 1 を除く 2 のべき乗のみ処理する. いろいろ端折ってる . 気がする. 実行 (ducci-seq (make-array 4 :initial-contents '(8 11 2 7) ) #(8 11 2 7) #(3 9 5 1) #(6 4 4 2) #(2 0 2 4) #(2 2 2 2) #(0 0 0 0). 実行 (ducci-seq (make-array 4 :initial-contents '(1 1 0 1) ) #(1 1 0 1) #(0 1 1 0) #(1 0 1 0) #(1 1 1 1) #(0 0 0 0) nil. N が 2 のべき乗以外も実装したい。
pgf2.blogspot.com
nameless: 2011-09
http://pgf2.blogspot.com/2011_09_01_archive.html
65339;Project Euler] Problem 188. 9670; Problem 188 - Project Euler. 9670; プログラミング (CommonLisp : SBCL). 65339;Project Euler] Problem 131. 9670; Problem 131 - Project Euler. N 3 pn 2 = (n k) 3. P = 19 の場合、. 8 3 19 * 8 2 = 12 3 より、 p = 19, n = 8, k = 4. 仮に n = x 3, k = x 2 とおく(※). N 3 pn 2 = (n k) 3 n 2 * (n p) = (n k) 3 n 2 * (n p) = n 3 3n 2k 3nk 2 k 3 ↓n = x 3, k = x 2 を代入 (x 3) 2 * (x 3 p) = (x 3) 3 3*(x 3) 2*x 2 3*x 3*(x 2) 2 (x 2) 3 p = 3x 2 3x 1. 3x 2 3x 1 が m 未満且つ素数となる値をカウントすればよい。 パスカルの三角形(...
pgf2.blogspot.com
nameless: 2011-05
http://pgf2.blogspot.com/2011_05_01_archive.html
65339;Javaで作って学ぶ暗号技術] フェルマーテスト. 9670; プログラミング (xyzzy-lisp). 乱数を発生 (defun random-number(g-num l-num) (let ( r (random l-num) ) (if (. J k) t (if (/= 1 (mod-pow-binary (random-number 1 n) (1- n) n) nil (is-probable-prime n k (1 j) ) ) ; フェルマーテスト (defun fermat-test(n k) (is-probable-prime n k 0) ; * * * 繰り返し * * * ; フェルマーテスト (defun fermat-test(n k) (do ( j 1 (1 j) ) ( = j k) t) (if (/= (mod-pow-binary (random-number 1 n) (1- n) n) 1) (return nil) ). P が素数であるとき,p の倍数でないような整数 a に対して,. 公開指数 e と秘密指数 d には. 9632;...
pgf2.blogspot.com
nameless: 2013-04
http://pgf2.blogspot.com/2013_04_01_archive.html
Anarchy golf - for for number loop with CommonLisp (clisp). Anarchy golf - for for number loop. 9670; for for number loop. 1 1 2 1 2 3 1 2 3 4 : 1 2 3 4 . n. 9671; 1 回目. Let ( a 0) (loop repeat (read) do (format t " { D } D %" (loop for x from 1 to (1-(incf a) collect x) a) ). 12288; ↓. Let( a 0) (loop repeat(read)do(format t" { D } D %"(loop for x from 1 to(1-(incf a) collect x)a) ). 9671; 2 回目. Dotimes (x (read) (dotimes(y x) (format t " D " (1 y) ) (format t " D %" (1 x) ). CL で最短は 65 文字らしい。 Loop for...
pgf2.blogspot.com
nameless: 2011-01
http://pgf2.blogspot.com/2011_01_01_archive.html
2011 年 1 月度の読了. ディアスポラ (ハヤカワ文庫 SF) - Greg Egan 著, 山岸 真 訳. 12288;( 01/03). メビウスの帯 - Clifford A. Pickover 著, 吉田 三知世 訳. 12288;( 01/12). 12288;→ メモ:ソレノイドとカントール集合. いち・たす・いち (脳の方程式) - 中田 力 著. 12288;( 01/15). 暗号の整数論 - 素数研究が生きるセキュリティ技術 (現代技術への数学入門シリーズ) - 境 隆一, 金子 昌信 著, 若山 正人 編集. 12288;( 01/17). 12288;→ メモ: 2 次ふるい法. プロセッサを支える技術 - 果てしなくスピードを追求する世界 (WEB DB PRESS plus) - Hisa Ando 著. 12288;( 01/26). 12288;→ メモ:「第 4 章 仮想化サポート」と「第 5 章 マルチプロセッサの出現と普及」. 12288;( 01/31). 2011 年 1 月度の読了.
pgf2.blogspot.com
nameless: 2011-11
http://pgf2.blogspot.com/2011_11_01_archive.html
65339;AOJ] Volume13 - 1310 : Find the Multiples. Volume13 - 1310 : Find the Multiples. 9670; プログラミング (java). 0 : mget(key); m.put(key, ( m.get(key) = null)? 0 : mget(key) 1); } return retval; } static int solve2(int[] a, int n, int s, int w, int q) { int retval = 0; int nz = 0; for(int i=0; i n; i ) { if(a[i] 0) nz ; if(a[i] = 0 a[i] % q = 0) retval = nz; } return retval; } }. 65339;Project Euler] Problem 5. 12288;( 日本語訳. 9670; 実装 (CommonLisp: xyzzy-lisp). M = 10 2520 m = 20 232792560. 12288;( 日本語訳.
pgf2.blogspot.com
nameless: 2011-10
http://pgf2.blogspot.com/2011_10_01_archive.html
65339;Project Euler] Problem 211. 12288;( 日本語訳. Defun factor-count-numbers(m) (do ( i 1 (1 i) (array (make-array (list (1 m) :initial-element 0) ) ( i m) array) (let ( j i) (loop (if ( j m) (return) (setf (aref array j) (1 (aref array j) ) (setq j ( j i) ) ). Defun factor-sum-numbers(m) (do ( i 1 (1 i) (array (make-array (list (1 m) :initial-element 0) ) ( i m) array) (let ( j i) (loop (if ( j m) (return) (setf (aref array j) ( i (aref array j) ) (setq j ( j i) ) ). 要、Heap サイズの設定。 12288;( 日本語訳. Package a...
pgf2.blogspot.com
nameless: 2012-09
http://pgf2.blogspot.com/2012_09_01_archive.html
Anarchy golf - Fibonacci Numbers with CommonLisp (clisp). 次は Fibonacci Numbers で。 Anarchy golf - Fibonacci Numbers. 9670; Fibonacci Numbers. F(1)=1, f(2)=1, f(n)=f(n-1) f(n-2). F(1) から f(46) まで出力する. Do ( a 1)(b 1)(c 0)(x 0 (1 x) ) ( = x 46) (format t " A %" a) (setq c a) (setq a b) (setq b ( c b) ). Do* ( a 0 (- b a) (b 1 ( a b) ) ( a 1836311903) (format t" [ :; A % ]"a a). 12288; ↓. Do*( a 0(- b a) (b 1( a b) )( a 1836311903) (format t" [ :; A % ]"a a). 12288; ↓. 12288; ↓. 紆余曲折を経てやっと 66 文字。 Class tes...
SOCIAL ENGAGEMENT