freeCodeCamp/curriculum/challenges/russian/08-coding-interview-prep/project-euler/problem-35-circular-primes....

1.9 KiB
Raw Blame History

id challengeType title videoUrl localeTitle
5900f38f1000cf542c50fea2 5 Problem 35: Circular primes

Description

Число 197, называется круговым простым, поскольку все повороты цифр: 197, 971 и 719 сами по себе являются первыми. Есть тринадцать таких простых чисел ниже 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79 и 97. Сколько круговых простых чисел ниже n, тогда как 100 <= n < = 1000000?

Instructions

undefined

Tests

tests:
  - text: <code>circularPrimes(100)</code> должен возвращать 13.
    testString: 'assert(circularPrimes(100) == 13, "<code>circularPrimes(100)</code> should return 13.");'
  - text: <code>circularPrimes(100000)</code> должен возвращать 43.
    testString: 'assert(circularPrimes(100000) == 43, "<code>circularPrimes(100000)</code> should return 43.");'
  - text: ''
    testString: 'assert(circularPrimes(250000) == 45, "<code>circularPrimes(250000)</code> should return 45.");'
  - text: <code>circularPrimes(500000)</code> должен вернуть 49.
    testString: 'assert(circularPrimes(500000) == 49, "<code>circularPrimes(500000)</code> should return 49.");'
  - text: <code>circularPrimes(750000)</code> должен вернуть 49.
    testString: 'assert(circularPrimes(750000) == 49, "<code>circularPrimes(750000)</code> should return 49.");'
  - text: ''
    testString: 'assert(circularPrimes(1000000) == 55, "<code>circularPrimes(1000000)</code> should return 55.");'

Challenge Seed

function circularPrimes(n) {
  // Good luck!
  return n;
}

circularPrimes(1000000);

Solution

// solution required