Comment detail

倍数になる13進数 (Nested Flatten)

Factor です。ちなみに一行にするとこうなります。

: f dup number>string 13 base> over mod 0 = [ ] [ 1 + f ] if ; 10 f .

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
USING: kernel math math.parser strings prettyprint ;

: base13 ( n -- n13 )
  number>string 13 base> ;

: it? ( n13 n10 -- t/f )
  mod 0 = ;

: f ( n -- n )
  dup base13 over it?
  [ ] [ 1 + f ] if ;

10 f .

Index

Feed

Other

Link

Pathtraq

loading...