トップページ > プログラム > 2015年09月26日 > VPLzo2d+

書き込み順位&時間帯一覧

32 位/188 ID中時間01234567891011121314151617181920212223Total
書き込み数0000011000000000000000002



使用した名前一覧書き込んだスレッド一覧
デフォルトの名無しさん
プログラミングのお題スレ Part7 [転載禁止]©2ch.net

書き込みレス一覧

プログラミングのお題スレ Part7 [転載禁止]©2ch.net
898 :デフォルトの名無しさん[sage]:2015/09/26(土) 05:41:15.64 ID:VPLzo2d+
>>857 Squeak Smalltalk

| len e x delta digits lastPos |
len := 10.
e := 2 asScaledDecimal.
x := 1.
lastPos := 2.
[ | ans |
 [e := e + (delta := 1 / (x := x + 1) factorial). delta log negated > len] whileFalse.
 digits := (e asScaledDecimal: delta log asInteger negated) asString upTo: $s.
 lastPos + 1 to: digits size - len + 1 do: [:pos |
  ((digits at: (lastPos := pos)) ~= $0) ifTrue: [
   ans := (digits copyFrom: pos to: pos + len - 1) asInteger.
   ((Integer primesUpTo: ans sqrt + 1) noneSatisfy: [:p | ans isDivisibleBy: p])
    ifTrue: [^ans]
  ]
 ]
] repeat "=> 7427466391 "
プログラミングのお題スレ Part7 [転載禁止]©2ch.net
900 :デフォルトの名無しさん[sage]:2015/09/26(土) 06:08:21.02 ID:VPLzo2d+
>>885 GNU Smalltalk

(1 to: 9) inject: 0 into: [:prev :i | (prev * 10 + i) printNl]

https://ideone.com/agFsbZ


※このページは、『2ちゃんねる』の書き込みを基に自動生成したものです。オリジナルはリンク先の2ちゃんねるの書き込みです。
※このサイトでオリジナルの書き込みについては対応できません。
※何か問題のある場合はメールをしてください。対応します。