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

Commonmark migration
Source Link

#M , (削除) 9 (削除ここまで) 6 bytes

M , (削除) 9 (削除ここまで) 6 bytes

Thanks to FryAmTheEggman for saving 3 bytes! Code:

RİSg1İ

M has a huge advantage here, because it works with fractions rather than floats. Explanation:

R # Get the list [1 ... n].
 İ # Inverse each, resulting into [1/1, 1/2, 1/3, ..., 1/n].
 S # Sum it up. (86021/27720 for n=12)
 g1 # Compute the greatest common denominator with n. (1/27720 for n=12)
 İ # Calculate the inverse again. (27720 for n=12)

Uses the Jelly encoding. Try it online!.


Also, there is a 4-byte solution, which outputs a leading zero sometimes (e.g. 280 -> 0280). I'm not sure if this is allowed or not:

RİSV

Try it online!.

#M , (削除) 9 (削除ここまで) 6 bytes

Thanks to FryAmTheEggman for saving 3 bytes! Code:

RİSg1İ

M has a huge advantage here, because it works with fractions rather than floats. Explanation:

R # Get the list [1 ... n].
 İ # Inverse each, resulting into [1/1, 1/2, 1/3, ..., 1/n].
 S # Sum it up. (86021/27720 for n=12)
 g1 # Compute the greatest common denominator with n. (1/27720 for n=12)
 İ # Calculate the inverse again. (27720 for n=12)

Uses the Jelly encoding. Try it online!.


Also, there is a 4-byte solution, which outputs a leading zero sometimes (e.g. 280 -> 0280). I'm not sure if this is allowed or not:

RİSV

Try it online!.

M , (削除) 9 (削除ここまで) 6 bytes

Thanks to FryAmTheEggman for saving 3 bytes! Code:

RİSg1İ

M has a huge advantage here, because it works with fractions rather than floats. Explanation:

R # Get the list [1 ... n].
 İ # Inverse each, resulting into [1/1, 1/2, 1/3, ..., 1/n].
 S # Sum it up. (86021/27720 for n=12)
 g1 # Compute the greatest common denominator with n. (1/27720 for n=12)
 İ # Calculate the inverse again. (27720 for n=12)

Uses the Jelly encoding. Try it online!.


Also, there is a 4-byte solution, which outputs a leading zero sometimes (e.g. 280 -> 0280). I'm not sure if this is allowed or not:

RİSV

Try it online!.

added 7 characters in body
Source Link
Adnan
  • 44.7k
  • 6
  • 83
  • 248

#M, (削除) 9 (削除ここまで) 6 bytes

Thanks to FryAmTheEggman for saving 3 bytes! Code:

RİSg1İ

M has a huge advantage here, because it works with fractions rather than floats. Explanation:

R # Get the list [1 ... n].
 İ # Inverse each, resulting into [1/1, 1/2, 1/3, ..., 1/n].
 S # Sum it up. (86021/27720 for n=12)
 g g1 # Compute the greatest common denominator with n. (1/27720 for n=12)
  İ # Calculate the inverse again. (27720 for n=12)

Uses the Jelly encoding. Try it online!.


Also, there is a 4-byte solution, which outputs a leading zero sometimes (e.g. 280 -> 0280). I'm not sure if this is allowed or not:

RİSV

Try it online!.

#M, (削除) 9 (削除ここまで) 6 bytes

Thanks to FryAmTheEggman for saving 3 bytes! Code:

RİSg1İ

M has a huge advantage here, because it works with fractions rather than floats. Explanation:

R # Get the list [1 ... n].
 İ # Inverse each, resulting into [1/1, 1/2, 1/3, ..., 1/n].
 S # Sum it up. (86021/27720 for n=12)
 g  # Compute the greatest common denominator. (1/27720 for n=12)
  # Calculate the inverse again. (27720 for n=12)

Uses the Jelly encoding. Try it online!.


Also, there is a 4-byte solution, which outputs a leading zero sometimes (e.g. 280 -> 0280). I'm not sure if this is allowed or not:

RİSV

Try it online!.

#M, (削除) 9 (削除ここまで) 6 bytes

Thanks to FryAmTheEggman for saving 3 bytes! Code:

RİSg1İ

M has a huge advantage here, because it works with fractions rather than floats. Explanation:

R # Get the list [1 ... n].
 İ # Inverse each, resulting into [1/1, 1/2, 1/3, ..., 1/n].
 S # Sum it up. (86021/27720 for n=12)
 g1 # Compute the greatest common denominator with n. (1/27720 for n=12)
  İ # Calculate the inverse again. (27720 for n=12)

Uses the Jelly encoding. Try it online!.


Also, there is a 4-byte solution, which outputs a leading zero sometimes (e.g. 280 -> 0280). I'm not sure if this is allowed or not:

RİSV

Try it online!.

added 398 characters in body
Source Link
Adnan
  • 44.7k
  • 6
  • 83
  • 248

#M, (削除) 9 (削除ここまで) 6 bytes

Thanks to FryAmTheEggman for saving 3 bytes! Code:

RİSg1İ

M has a huge advantage here, because it works with fractions rather than floats. Explanation:

R # Get the list [1 ... n].
 İ # Inverse each, resulting into [1/1, 1/2, 1/3, ..., 1/n].
 S # Sum it up. (86021/27720 for n=12)
 g # Compute the greatest common denominator. (1/27720 for n=12)
 1İ # Calculate the inverse again. (27720 for n=12)

Uses the Jelly encoding. Try it online!.


Also, there is a 4-byte solution, which outputs a leading zero sometimes (e.g. 280 -> 0280). I'm not sure if this is allowed or not:

RİSV

Try it online!.

#M, (削除) 9 (削除ここまで) 6 bytes

Thanks to FryAmTheEggman for saving 3 bytes! Code:

RİSg1İ

Uses the Jelly encoding. Try it online!.


Also, there is a 4-byte solution, which outputs a leading zero sometimes (e.g. 280 -> 0280). I'm not sure if this is allowed or not:

RİSV

Try it online!.

#M, (削除) 9 (削除ここまで) 6 bytes

Thanks to FryAmTheEggman for saving 3 bytes! Code:

RİSg1İ

M has a huge advantage here, because it works with fractions rather than floats. Explanation:

R # Get the list [1 ... n].
 İ # Inverse each, resulting into [1/1, 1/2, 1/3, ..., 1/n].
 S # Sum it up. (86021/27720 for n=12)
 g # Compute the greatest common denominator. (1/27720 for n=12)
 1İ # Calculate the inverse again. (27720 for n=12)

Uses the Jelly encoding. Try it online!.


Also, there is a 4-byte solution, which outputs a leading zero sometimes (e.g. 280 -> 0280). I'm not sure if this is allowed or not:

RİSV

Try it online!.

added 247 characters in body
Source Link
Adnan
  • 44.7k
  • 6
  • 83
  • 248
Loading
deleted 7 characters in body
Source Link
Adnan
  • 44.7k
  • 6
  • 83
  • 248
Loading
Source Link
Adnan
  • 44.7k
  • 6
  • 83
  • 248
Loading

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