Repunits are numbers that consist entirely of repetitions of the digit one (unity). The notation Rn symbolizes the repunit made up of n ones.

Every prime p larger than 5, evenly divides the repunit Rp-1.



E.G.
The repunit R6 is evenly divisible by 7.

111111 / 7 = 15873

The repunit R42 is evenly divisible by 43.

111111111111111111111111111111111111111111 / 43 = 2583979328165374677002583979328165374677

And so on.



There are composite numbers that also have this same property. They are often referred to as deceptive non-primes or deceptive numbers.



The repunit R90 is evenly divisible by the composite number 91 (=7*13).

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 / 91 = 1221001221001221001221001221001221001221001221001221001221001221001221001221001221001221


Task 
 Find and show at least the first 10 deceptive numbers; composite numbers n that evenly divide the repunit Rn-1


See also
 Numbers Aplenty - Deceptive numbers
 OEIS:A000864 - Deceptive nonprimes: composite numbers k that divide the repunit R_{k-1}




import math.big
 
fn is_prime(n int) bool {
    if n < 2 {
        return false
    } else if n%2 == 0 {
        return n == 2
    } else if n%3 == 0 {
        return n == 3
    } else {
        mut d := 5
        for d*d <= n {
            if n%d == 0 {
                return false
            }
            d += 2
            if n%d == 0 {
                return false
            }
            d += 4
        }
        return true
    }
}
 
fn main() {
    mut count := 0
    limit := 25
    mut n := i64(17)
    mut repunit := big.integer_from_i64(1111111111111111)
    mut t := big.integer_from_int(0)
    zero := big.integer_from_int(0)
    eleven := big.integer_from_int(11)
    hundred := big.integer_from_int(100)
    mut deceptive := []i64{}
    for count < limit {
        if !is_prime(int(n)) && n%3 != 0 && n%5 != 0 {
            bn := big.integer_from_i64(n)
            t = repunit % bn
            if t == zero {
                deceptive << n
                count++
            }
        }
        n += 2
        repunit = repunit * hundred
        repunit = repunit + eleven
    }
    println("The first $limit deceptive numbers are:")
    println(deceptive)
}
 