A335012 Number of different remainders when the first n terms of 1, 11, 111, 1111, ... are divided by n.
1, 1, 3, 2, 1, 3, 6, 3, 9, 1, 2, 4, 6, 6, 3, 4, 16, 9, 18, 2, 6, 2, 22, 5, 2, 6, 27, 7, 28, 3, 15, 5, 6, 16, 6, 10, 3, 18, 6, 3, 5, 6, 21, 3, 9, 22, 46, 6, 42, 2, 48, 7, 13, 27, 2, 8, 18, 28, 58, 4, 60, 15, 18, 6, 6, 6, 33, 17, 66, 6, 35, 11, 8, 3, 4, 19, 6, 6, 13, 4, 81
Offset: 1
Examples
a(4) = 2 since when 1, 11, 111, 1111 are divided by 4 the remainders are 1, 3, 3, 3, two different numbers. a(6) = 3 since when 1, 11, 111, 1111, 11111, 111111 are divided by 6 the remainders are 1, 5, 3, 1, 5, 3, three different numbers.
Programs
-
Maple
with(ListTools): a := proc (n) return add(10^i, i = 0 .. n-1) end proc: r := proc (n) return seq(`mod`(a(i), n), i = 1 .. n) end proc: seq(nops(MakeUnique([r(n)])), n = 1 .. 243); # Simpler: f:= n -> nops({seq(((10^i-1)/9) mod n,i=1..n)}): map(f, [$1..100]); # Robert Israel, Jun 25 2020
-
Mathematica
Table[Length@ Union@ Array[Mod[(10^# - 1)/9, n] &, n], {n, 81}] (* Michael De Vlieger, Jun 28 2020 *)
-
PARI
a(n) = #Set(vector(n, k, (10^k-1)/9) % n); \\ Michel Marcus, Jun 15 2020
Comments