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 185 characters in body
Source Link
xash
  • 11.3k
  • 1
  • 15
  • 39

Brachylog, 77 6 bytes

ṗ⊇ubṗsĖṗ⊇uṗsȮ

Try it online! Try it online!

How it works

ṗ⊇ubṗsĖṗ⊇uṗsȮ the implicit input
ṗ is a prime
 ⊇u and from every unique subset
 b without the input itself
 ṗs select the primes
 ĖȮ and this should be an emptya list

Slower but simpler alternative, 7 bytes

⊇uṗs[?]
⊇u  from the unique subsets
 ṗs select all primes
 with [?]one andelement (the result is just theprime input in a listitself)

Brachylog, 7 bytes

ṗ⊇ubṗsĖ

Try it online!

How it works

ṗ⊇ubṗsĖ the implicit input
ṗ is a prime
 ⊇u and from every unique subset
 b without the input itself
 ṗs select the primes
 Ė and this should be an empty list

Slower but simpler alternative, 7 bytes

⊇uṗs[?]
⊇u  from the unique subsets
 ṗs select all primes
  [?] and the result is just the input in a list

Brachylog, 7 6 bytes

ṗ⊇uṗsȮ

Try it online!

ṗ⊇uṗsȮ the implicit input
ṗ is a prime
 ⊇u and from every unique subset
 ṗs select the primes
 Ȯ and this should be a list with one element (the prime input itself)
added 185 characters in body
Source Link
xash
  • 11.3k
  • 1
  • 15
  • 39

Brachylog, 7 bytes

ṗ⊇ubṗsĖ

Try it online!

How it works

ṗ⊇ubṗsĖ the implicit input
ṗ is a prime
 ⊇u and from every unique subset
 b without the input itself
 ṗs select the primes
 Ė and this should be an empty list

Slower but simpler alternative, 7 bytes

⊇uṗs[?]
⊇u from the unique subsets
 ṗs select all primes
 [?] and the result is just the input in a list

Brachylog, 7 bytes

ṗ⊇ubṗsĖ

Try it online!

How it works

ṗ⊇ubṗsĖ the implicit input
ṗ is a prime
 ⊇u and from every unique subset
 b without the input itself
 ṗs select the primes
 Ė and this should be an empty list

Brachylog, 7 bytes

ṗ⊇ubṗsĖ

Try it online!

How it works

ṗ⊇ubṗsĖ the implicit input
ṗ is a prime
 ⊇u and from every unique subset
 b without the input itself
 ṗs select the primes
 Ė and this should be an empty list

Slower but simpler alternative, 7 bytes

⊇uṗs[?]
⊇u from the unique subsets
 ṗs select all primes
 [?] and the result is just the input in a list
Source Link
xash
  • 11.3k
  • 1
  • 15
  • 39

Brachylog, 7 bytes

ṗ⊇ubṗsĖ

Try it online!

How it works

ṗ⊇ubṗsĖ the implicit input
ṗ is a prime
 ⊇u and from every unique subset
 b without the input itself
 ṗs select the primes
 Ė and this should be an empty list

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