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.

A381370 Smallest number with reciprocal of period length n in base 9.

Original entry on oeis.org

1, 2, 5, 7, 32, 11, 35, 547, 17, 19, 25, 23, 224, 398581, 29, 31, 128, 103, 95, 1597, 352, 43, 115, 47, 97, 151, 53, 109, 928, 59, 155, 683, 256, 161, 515, 71, 608, 18427, 7985, 79, 187, 83, 203, 431, 89, 181, 235, 1223, 896, 491, 101
Offset: 0

Views

Author

Erich Friedman, Feb 25 2025

Keywords

Comments

For n > 1, a(n) is the smallest positive d such that d divides 9^n - 1 and does not divide any of 9^k - 1 for 0 < k < n.

Examples

			a(3)=7 because 1/7 has period 3 in base 9 (.125125125...) and no smaller number has this property.
		

References

  • J. Brillhart et al., Factorizations of b^n +- 1. Contemporary Mathematics, Vol. 22, Amer. Math. Soc., Providence, RI, 2nd edition, 1985; and later supplements.

Crossrefs

Programs

  • Mathematica
    a[n_] := First[Select[Divisors[9^n - 1], MultiplicativeOrder[9, #] == n &, 1]];
    a[0] = 1; a[1] = 2; Table[a[n], {n, 0, 50}]
  • Python
    from sympy import divisors
    def A381370(n): return next(d for d in divisors(9**n-1) if d>1 and all(pow(9,k,d)!=1 for k in range(1,n))) if n else 1 # Chai Wah Wu, Feb 28 2025