Tap here to switch tabs
Problem
Submissions

Problem: Sum of Primes Between Number and Its Reverse

Sum of Primes Between Number and Its Reverse asks you to reverse a given integer, then return the sum of every prime from the smaller value through the larger one, inclusive, or zero if none exist.

Statement

You are given an integer n.

Let rev be the integer obtained by reversing the decimal digits of n. Define the range as [min⁡(‘n‘,‘rev‘),max⁡(‘n‘,‘rev‘)][\min(`n`, `rev`), \max(`n`, `rev`)].

Return the sum of all prime numbers located within this inclusive range. If there are no prime numbers in the range, return 00.

Constraints:

  • 1≤1 \leq n ≤1000\leq 1000

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Sum of Primes Between Number and Its Reverse

Sum of Primes Between Number and Its Reverse asks you to reverse a given integer, then return the sum of every prime from the smaller value through the larger one, inclusive, or zero if none exist.

Statement

You are given an integer n.

Let rev be the integer obtained by reversing the decimal digits of n. Define the range as [min⁡(‘n‘,‘rev‘),max⁡(‘n‘,‘rev‘)][\min(`n`, `rev`), \max(`n`, `rev`)].

Return the sum of all prime numbers located within this inclusive range. If there are no prime numbers in the range, return 00.

Constraints:

  • 1≤1 \leq n ≤1000\leq 1000