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 209 characters in body
Source Link
Martin Ender
  • 198.2k
  • 67
  • 455
  • 998

Mathematica, 20(削除) 20 (削除ここまで) 18 bytes

{⌊#/#2⌋,Mod@##}&#2⌋@Mod@##&

Only marginallyMinor abuse of the flexible output rules: the result is given as div[mod], which will remain unevaluated. The individual numbers can be extracted with result[[0]] and result[[1]].

And hey, it's only one byte longer than the ridiculously named built-in QuotientRemainder.

Mathematica, actually has a neat way to apply multiple functions to the same input, but it's three bytes longer:

Through@*{Quotient,Mod}

Mathematica, 20 bytes

{⌊#/#2⌋,Mod@##}&

Only marginally longer than the ridiculously named built-in QuotientRemainder.

Mathematica, actually has a neat way to apply multiple functions to the same input, but it's three bytes longer:

Through@*{Quotient,Mod}

Mathematica, (削除) 20 (削除ここまで) 18 bytes

⌊#/#2⌋@Mod@##&

Minor abuse of the flexible output rules: the result is given as div[mod], which will remain unevaluated. The individual numbers can be extracted with result[[0]] and result[[1]].

And hey, it's only one byte longer than the ridiculously named built-in QuotientRemainder.

Mathematica, actually has a neat way to apply multiple functions to the same input, but it's three bytes longer:

Through@*{Quotient,Mod}
Source Link
Martin Ender
  • 198.2k
  • 67
  • 455
  • 998

Mathematica, 20 bytes

{⌊#/#2⌋,Mod@##}&

Only marginally longer than the ridiculously named built-in QuotientRemainder.

Mathematica, actually has a neat way to apply multiple functions to the same input, but it's three bytes longer:

Through@*{Quotient,Mod}

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