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 Revisions

2 of 2
deleted 17 characters in body
J. Sallé
  • 3.5k
  • 10
  • 24

APL (Dyalog Unicode), (削除) 15 (削除ここまで) 12 bytes

⌽!(,÷∨)1⊥!÷⍳

Try it online!

Tacit function, taking a single argument . Saves a byte by removing the if we're allowed to print the denominator first.

Thanks @dzaima for 3 bytes.

How:

⌽!(,÷∨)1⊥!÷⍳ ⍝ Tacit function, argument will be called ⍵.
 ⍳ ⍝ Range 1..⍵ 
 ÷ ⍝ Dividing
 ! ⍝ the factorial of ⍵
 1⊥ ⍝ Base-1 decode, aka sum;
 !( ) ⍝ Using that sum and the factorial of ⍵ as arguments, fork:
 ∨ ⍝ (GCD
 ÷ ⍝ dividing
 , ⍝ the vector with both arguments)
⌽ ⍝ reversed.
 
J. Sallé
  • 3.5k
  • 10
  • 24

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