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

I screwed up the link
Source Link
DJMcMayhem
  • 60.1k
  • 18
  • 203
  • 352

Bubblegum, 98 bytes

00000000: 6672 6f6d 206d 6174 6820 696d 706f 7274 from math import
00000010: 2066 6163 746f 7269 616c 2061 7320 4623 factorial as F#
00000020: 0a74 7279 3a6e 3d69 6e74 2869 292d 313b .try:n=int(i)-1;o=n*1;
00000030: 6f3d 6e2a 2846 286e 2925 2d7e 6e3d 3d6e o=n*(F(n)%-~n==n)
00000040: 290a 6578 6365 7074 3a6f 3d73 756d 286d ).except:o=sum(mapm
00000050: 6170 2869 6e74 2c69 2e73 706c 6974 2829 ap(int,i.split()
00000060: 2929 ))

Try it online! Try it online! (Note that the online interpreter takes input in xxd format)

Bubblegum is really good at three things:

  1. Compressing large outputs,

  2. Testing for primality, and

  3. Adding a sequence of numbers.

It's really really really bad at everything else.

Bubblegum, 98 bytes

from math import factorial as F#
try:n=int(i)-1;o=n*(F(n)%-~n==n)
except:o=sum(map(int,i.split()))

Try it online! (Note that the online interpreter takes input in xxd format)

Bubblegum is really good at three things:

  1. Compressing large outputs,

  2. Testing for primality, and

  3. Adding a sequence of numbers.

It's really really really bad at everything else.

Bubblegum, 98 bytes

00000000: 6672 6f6d 206d 6174 6820 696d 706f 7274 from math import
00000010: 2066 6163 746f 7269 616c 2061 7320 4623 factorial as F#
00000020: 0a74 7279 3a6e 3d69 6e74 2869 292d 313b .try:n=int(i)-1;
00000030: 6f3d 6e2a 2846 286e 2925 2d7e 6e3d 3d6e o=n*(F(n)%-~n==n
00000040: 290a 6578 6365 7074 3a6f 3d73 756d 286d ).except:o=sum(m
00000050: 6170 2869 6e74 2c69 2e73 706c 6974 2829 ap(int,i.split()
00000060: 2929 ))

Try it online! (Note that the online interpreter takes input in xxd format)

Bubblegum is really good at three things:

  1. Compressing large outputs,

  2. Testing for primality, and

  3. Adding a sequence of numbers.

It's really really really bad at everything else.

Source Link
DJMcMayhem
  • 60.1k
  • 18
  • 203
  • 352

Bubblegum, 98 bytes

from math import factorial as F#
try:n=int(i)-1;o=n*(F(n)%-~n==n)
except:o=sum(map(int,i.split()))

Try it online! (Note that the online interpreter takes input in xxd format)

Bubblegum is really good at three things:

  1. Compressing large outputs,

  2. Testing for primality, and

  3. Adding a sequence of numbers.

It's really really really bad at everything else.

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