cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A335012 Number of different remainders when the first n terms of 1, 11, 111, 1111, ... are divided by n.

Original entry on oeis.org

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

Views

Author

Sen-Peng Eu, May 19 2020

Keywords

Comments

a(n) = n if and only if n is a power of 3.
Conjecture: a(n) = n-1 if and only if n is a long period prime (A006883), that is, n is a prime and the decimal expansion of 1/n has period n-1.
If gcd(n,30) = 1 then a(n) = A084680(n). - Robert Israel, Jun 25 2020

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.
		

Crossrefs

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