2018-09-30 23:01:58 +01:00
---
id: 5900f3ee1000cf542c50ff00
title: 'Problem 130: Composites with prime repunit property'
2020-11-27 19:02:05 +01:00
challengeType: 5
2019-08-05 09:17:33 -07:00
forumTopicId: 301758
2021-01-13 03:31:00 +01:00
dashedName: problem-130-composites-with-prime-repunit-property
2018-09-30 23:01:58 +01:00
---
2020-11-27 19:02:05 +01:00
# --description--
2018-09-30 23:01:58 +01:00
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.
2020-11-27 19:02:05 +01:00
2018-09-30 23:01:58 +01:00
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.
2020-11-27 19:02:05 +01:00
2018-09-30 23:01:58 +01:00
You are given that for all primes, p > 5, that p − 1 is divisible by A(p). For example, when p = 41, A(41) = 5, and 40 is divisible by 5.
2020-11-27 19:02:05 +01:00
However, there are rare composite values for which this is also true; the first five examples being 91, 259, 451, 481, and 703.
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
Find the sum of the first twenty-five composite values of n for whichGCD(n, 10) = 1 and n − 1 is divisible by A(n).
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
# --hints--
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
`euler130()` should return 149253.
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
```js
assert.strictEqual(euler130(), 149253);
2018-09-30 23:01:58 +01:00
```
2020-11-27 19:02:05 +01:00
# --seed--
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
## --seed-contents--
2018-09-30 23:01:58 +01:00
```js
function euler130() {
2020-09-15 09:57:40 -07:00
2018-09-30 23:01:58 +01:00
return true;
}
euler130();
```
2020-11-27 19:02:05 +01:00
# --solutions--
2018-09-30 23:01:58 +01:00
```js
// solution required
```