OFFSET
1,1
COMMENTS
The multiplicative order of a mod m, gcd(a,m)=1, is the smallest natural number d for which a^d = 1 (mod m).
The number of unit fractions 1/k having a decimal expansion of period n and with k coprime to 10. - T. D. Noe, May 18 2007
Also, number of primitive factors of 10^n - 1 (cf. A003060). - Max Alekseyev, May 03 2022
a(n) is odd if and only if n is squarefree. Proof: Note that 10^d - 1 == 3 (mod 4) for d >= 2, so 10^d - 1 is a square if and only if d = 1. From the formula we can see that a(n) is odd if and only if mu(n) is nonzero, or n is squarefree. - Jianing Song, Jun 15 2021
FORMULA
MAPLE
with(numtheory):
a:= n-> add(mobius(n/d)*tau(10^d-1), d=divisors(n)):
seq(a(n), n=1..30); # Alois P. Heinz, Oct 12 2012
MATHEMATICA
f[n_, d_] := MoebiusMu[n/d]*Length[Divisors[10^d - 1]]; a[n_] := Total[(f[n, #] & ) /@ Divisors[n]]; Table[a[n], {n, 1, 56}] (* Jean-François Alcover, Mar 21 2011 *)
PROG
(PARI) j=[]; for(n=1, 10, j=concat(j, sumdiv(n, d, moebius(n/d)*numdiv(10^d-1)))); j
(Python)
from sympy import divisors, mobius, divisor_count
def a(n): return sum(mobius(n//d)*divisor_count(10**d - 1) for d in divisors(n)) # Indranil Ghosh, Apr 23 2017
CROSSREFS
KEYWORD
nonn,nice
AUTHOR
Vladeta Jovovic, Feb 06 2001
EXTENSIONS
More terms from Jason Earls, Aug 06 2001.
Terms to a(280) in b-file from T. D. Noe, Oct 01 2013
a(281)-a(322) in b-file from Ray Chandler, May 03 2017
a(323)-a(352) in b-file from Max Alekseyev, May 03 2022
STATUS
approved