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 167 characters in body
Source Link
Noodle9
  • 20.4k
  • 3
  • 23
  • 47

Python 3, (削除) 86 (削除ここまで) 78(削除) 78 (削除ここまで) 87 bytes

Saved 8 bytes thanks to ovs!!!
Added 9 bytes to fix a bug kindly pointed out by Robin Ryder .

lambda s:all~-len(s)*all(n%i for n in(len(s),sum(ord(c)&31for c in s))for i in range(2,n))

Try it online! Try it online!

Returns Truea truthy or Falsefalsey value.

Python 3, (削除) 86 (削除ここまで) 78 bytes

Saved 8 bytes thanks to ovs!!!

lambda s:all(n%i for n in(len(s),sum(ord(c)&31for c in s))for i in range(2,n))

Try it online!

Returns True or False.

Python 3, (削除) 86 (削除ここまで) (削除) 78 (削除ここまで) 87 bytes

Saved 8 bytes thanks to ovs!!!
Added 9 bytes to fix a bug kindly pointed out by Robin Ryder .

lambda s:~-len(s)*all(n%i for n in(len(s),sum(ord(c)&31for c in s))for i in range(2,n))

Try it online!

Returns a truthy or falsey value.

added 30 characters in body
Source Link
Noodle9
  • 20.4k
  • 3
  • 23
  • 47

Python 3, (削除) 86 (削除ここまで) 78 bytes

Saved 8 bytes thanks to ovs!!!

lambda s:all(n%i for n in(len(s),sum(ord(c)&31for c in s))for i in range(2,n))

Try it online!

Returns True or False.

Python 3, (削除) 86 (削除ここまで) 78 bytes

Saved 8 bytes thanks to ovs!!!

lambda s:all(n%i for n in(len(s),sum(ord(c)&31for c in s))for i in range(2,n))

Try it online!

Python 3, (削除) 86 (削除ここまで) 78 bytes

Saved 8 bytes thanks to ovs!!!

lambda s:all(n%i for n in(len(s),sum(ord(c)&31for c in s))for i in range(2,n))

Try it online!

Returns True or False.

added 88 characters in body
Source Link
Noodle9
  • 20.4k
  • 3
  • 23
  • 47

Python 3, 86(削除) 86 (削除ここまで) 78 bytes

Saved 8 bytes thanks to ovs !!!

lambda s:pall(n%i for n in(len(s))&p(,sum(ord(c)&31for c in s))
p=lambda n:all(n%i for i in range(2,n))

Try it online! Try it online!

Python 3, 86 bytes

lambda s:p(len(s))&p(sum(ord(c)&31for c in s))
p=lambda n:all(n%i for i in range(2,n))

Try it online!

Python 3, (削除) 86 (削除ここまで) 78 bytes

Saved 8 bytes thanks to ovs !!!

lambda s:all(n%i for n in(len(s),sum(ord(c)&31for c in s))for i in range(2,n))

Try it online!

deleted 4 characters in body
Source Link
Noodle9
  • 20.4k
  • 3
  • 23
  • 47
Loading
Source Link
Noodle9
  • 20.4k
  • 3
  • 23
  • 47
Loading

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