Skip to main content
Notice removed Reward existing answer by Bubbler
Bounty Ended with Leo's answer chosen by Bubbler
Notice added Reward existing answer by Bubbler
Bounty Started worth 50 reputation by Bubbler
Commonmark migration
Source Link

An Integer is prime if and only if it is positive and has exactly 2 distinct divisors: 1 and itself. A twin prime pair is made of two elements: p and p±2, that are both prime.

You will be given a positive integer as input. Your task is to return a truthy / falsy depending on whether the given integer belongs to a twin pair, following the standard rules (the values need to be consistent).

##Test Cases

Test Cases

  • Truthy (Twin Primes): 3, 5, 7, 11, 13, 17, 19, 29, 31, 41, 43

  • Falsy (not Twin Primes): 2, 15, 20, 23, 37, 47, 97, 120, 566

This is , so the shortest code in bytes wins!

An Integer is prime if and only if it is positive and has exactly 2 distinct divisors: 1 and itself. A twin prime pair is made of two elements: p and p±2, that are both prime.

You will be given a positive integer as input. Your task is to return a truthy / falsy depending on whether the given integer belongs to a twin pair, following the standard rules (the values need to be consistent).

##Test Cases

  • Truthy (Twin Primes): 3, 5, 7, 11, 13, 17, 19, 29, 31, 41, 43

  • Falsy (not Twin Primes): 2, 15, 20, 23, 37, 47, 97, 120, 566

This is , so the shortest code in bytes wins!

An Integer is prime if and only if it is positive and has exactly 2 distinct divisors: 1 and itself. A twin prime pair is made of two elements: p and p±2, that are both prime.

You will be given a positive integer as input. Your task is to return a truthy / falsy depending on whether the given integer belongs to a twin pair, following the standard rules (the values need to be consistent).

Test Cases

  • Truthy (Twin Primes): 3, 5, 7, 11, 13, 17, 19, 29, 31, 41, 43

  • Falsy (not Twin Primes): 2, 15, 20, 23, 37, 47, 97, 120, 566

This is , so the shortest code in bytes wins!

edited body
Source Link
Taylor Raine
  • 8.7k
  • 2
  • 27
  • 51

An Integer is prime if and only if it is positive and has exactly 2 distinct divisors: 1 and itself. A twin prime pair is made of two elements: p and p+2p±2, that are both prime.

You will be given a positive integer as input. Your task is to return a truthy / falsy depending on whether the given integer belongs to a twin pair, following the standard rules (the values need to be consistent).

##Test Cases

  • Truthy (Twin Primes): 3, 5, 7, 11, 13, 17, 19, 29, 31, 41, 43

  • Falsy (not Twin Primes): 2, 15, 20, 23, 37, 47, 97, 120, 566

This is , so the shortest code in bytes wins!

An Integer is prime if and only if it is positive and has exactly 2 distinct divisors: 1 and itself. A twin prime pair is made of two elements: p and p+2, that are both prime.

You will be given a positive integer as input. Your task is to return a truthy / falsy depending on whether the given integer belongs to a twin pair, following the standard rules (the values need to be consistent).

##Test Cases

  • Truthy (Twin Primes): 3, 5, 7, 11, 13, 17, 19, 29, 31, 41, 43

  • Falsy (not Twin Primes): 2, 15, 20, 23, 37, 47, 97, 120, 566

This is , so the shortest code in bytes wins!

An Integer is prime if and only if it is positive and has exactly 2 distinct divisors: 1 and itself. A twin prime pair is made of two elements: p and p±2, that are both prime.

You will be given a positive integer as input. Your task is to return a truthy / falsy depending on whether the given integer belongs to a twin pair, following the standard rules (the values need to be consistent).

##Test Cases

  • Truthy (Twin Primes): 3, 5, 7, 11, 13, 17, 19, 29, 31, 41, 43

  • Falsy (not Twin Primes): 2, 15, 20, 23, 37, 47, 97, 120, 566

This is , so the shortest code in bytes wins!

Tweeted twitter.com/StackCodeGolf/status/889389945131085824
added 18 characters in body
Source Link
user70974
user70974

An Integer is prime if and only if it is positive and has exactly 2 distinct divisors: 1 and itself. A twin prime pair is made of two elements: p and p+2, that are both prime.

You will be given a positive integer as input. Your task is to return a truthy / falsy depending on whether the given integer belongs to a twin pair, following the standard rules (the values need to be consistent).

##Test Cases

  • Truthy (Twin Primes): 3, 5, 7, 11, 13, 17, 19, 29, 31, 41, 43

  • Falsy (not Twin Primes): 2, 15, 20, 23, 37, 47, 97, 120, 566

This is , so the shortest code in bytes wins!

An Integer is prime if and only if it is positive and has exactly 2 distinct divisors: 1 and itself. A twin prime pair is made of two elements: p and p+2, that are both prime.

You will be given a positive integer as input. Your task is to return a truthy / falsy depending on whether the given integer belongs to a twin pair, following the standard rules (the values need to be consistent).

##Test Cases

  • Truthy (Twin Primes): 3, 5, 7, 11, 13, 17, 19, 29, 31, 41, 43

  • Falsy (not Twin Primes): 2, 23, 37, 47, 97

This is , so the shortest code in bytes wins!

An Integer is prime if and only if it is positive and has exactly 2 distinct divisors: 1 and itself. A twin prime pair is made of two elements: p and p+2, that are both prime.

You will be given a positive integer as input. Your task is to return a truthy / falsy depending on whether the given integer belongs to a twin pair, following the standard rules (the values need to be consistent).

##Test Cases

  • Truthy (Twin Primes): 3, 5, 7, 11, 13, 17, 19, 29, 31, 41, 43

  • Falsy (not Twin Primes): 2, 15, 20, 23, 37, 47, 97, 120, 566

This is , so the shortest code in bytes wins!

Source Link
user70974
user70974
Loading