freeCodeCamp/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-129-repunit-divisibility.english.md
mrugesh 22afc2a0ca feat(learn): python certification projects (#38216)
Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
Co-authored-by: Kristofer Koishigawa <scissorsneedfoodtoo@gmail.com>
Co-authored-by: Beau Carnes <beaucarnes@gmail.com>
2020-05-27 13:19:08 +05:30

1.1 KiB

id, challengeType, isHidden, title, forumTopicId
id challengeType isHidden title forumTopicId
5900f3ef1000cf542c50ff01 5 false Problem 129: Repunit divisibility 301756

Description

A number consisting entirely of ones is called a repunit. We shall define R(k) to be a repunit of length k; for example, R(6) = 111111. Given that n is a positive integer and GCD(n, 10) = 1, it can be shown that there always exists a value, k, for which R(k) is divisible by n, and let A(n) be the least such value of k; for example, A(7) = 6 and A(41) = 5. The least value of n for which A(n) first exceeds ten is 17. Find the least value of n for which A(n) first exceeds one-million.

Instructions

Tests

tests:
  - text: <code>euler129()</code> should return 1000023.
    testString: assert.strictEqual(euler129(), 1000023);

Challenge Seed

function euler129() {
  // Good luck!
  return true;
}

euler129();

Solution

// solution required