Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

added 1 character in body
Source Link
reffu
  • 2k
  • 11
  • 11

Forth (gforth), 91(削除) 91 (削除ここまで)86 bytes

: d { n } 0 n 1 do n i mod 0= i * -1 * + loop ; 
: f { a b } a b = 1+ a d b = b d a = * * ;

Try it online! Try it online!

Forth (gforth) No Locals, 94 bytes

A more "Forthy" version that doesn't use local variables

: d 0 over 1 do over i mod 0= i * - loop nip ;
: f 2dup = 1+ -rot 2dup d -rot d = -rot = * * ;

Try it online!

Forth (gforth), 91 bytes

: d { n } 0 n 1 do n i mod 0= i * -1 * + loop ; 
: f { a b } a b = 1+ a d b = b d a = * * ;

Try it online!

Forth (gforth) No Locals, 94 bytes

A more "Forthy" version that doesn't use local variables

: d 0 over 1 do over i mod 0= i * - loop nip ;
: f 2dup = 1+ -rot 2dup d -rot d = -rot = * * ;

Try it online!

Forth (gforth), (削除) 91 (削除ここまで)86 bytes

: d { n } 0 n 1 do n i mod 0= i * - loop ; 
: f { a b } a b = 1+ a d b = b d a = * * ;

Try it online!

Forth (gforth) No Locals, 94 bytes

A more "Forthy" version that doesn't use local variables

: d 0 over 1 do over i mod 0= i * - loop nip ;
: f 2dup = 1+ -rot 2dup d -rot d = -rot = * * ;

Try it online!

Source Link
reffu
  • 2k
  • 11
  • 11

Forth (gforth), 91 bytes

: d { n } 0 n 1 do n i mod 0= i * -1 * + loop ; 
: f { a b } a b = 1+ a d b = b d a = * * ;

Try it online!

Forth (gforth) No Locals, 94 bytes

A more "Forthy" version that doesn't use local variables

: d 0 over 1 do over i mod 0= i * - loop nip ;
: f 2dup = 1+ -rot 2dup d -rot d = -rot = * * ;

Try it online!

AltStyle によって変換されたページ (->オリジナル) /