OFFSET
1,7
COMMENTS
Primes p such that a(p) = p-1 are in A001913. - Dmitry Kamenetsky, Nov 13 2008
When 1/n has a finite decimal expansion (namely, when n = 2^a*5^b), a(n) = 1 while A051626(n) = 0. - M. F. Hasler, Dec 14 2015
a(n.n) >= a(n) where n.n is A020338(n). - Davide Rotondo, Jun 13 2024
REFERENCES
J. H. Conway and R. K. Guy, The Book of Numbers, Copernicus Press, NY, 1996, pp. 159 etc.
LINKS
Jon E. Schoenfield, Table of n, a(n) for n = 1..10000 (first 1000 terms from T. D. Noe)
Project Euler, Reciprocal cycles: Problem 26
FORMULA
Note that if n=r*s where r is a power of 2 and s is odd then a(n)=a(s). Also if n=r*s where r is a power of 5 and s is not divisible by 5 then a(n) = a(s). So we just need a(n) for n not divisible by 2 or 5. This is the smallest number m such that n divides 10^m - 1; m is a divisor of phi(n), where phi = A000010.
phi(n) = n-1 only if n is prime and since a(n) divides phi(n), a(n) can only equal n-1 if n is prime. - Scott Hemphill (hemphill(AT)alumni.caltech.edu), Nov 23 2006
MAPLE
A007732 := proc(n)
a132740 := 1 ;
for pe in ifactors(n)[2] do
if not op(1, pe) in {2, 5} then
a132740 := a132740*op(1, pe)^op(2, pe) ;
end if;
end do:
if a132740 = 1 then
1 ;
else
numtheory[order](10, a132740) ;
end if;
end proc:
seq(A007732(n), n=1..50) ; # R. J. Mathar, May 05 2023
MATHEMATICA
Table[r = n/2^IntegerExponent[n, 2]/5^IntegerExponent[n, 5]; MultiplicativeOrder[10, r], {n, 100}] (* T. D. Noe, Oct 17 2012 *)
PROG
(PARI) a(n)=znorder(Mod(10, n/2^valuation(n, 2)/5^valuation(n, 5))) \\ Charles R Greathouse IV, Jan 14 2013
(Sage)
def a(n):
n = ZZ(n)
rad = 2**n.valuation(2) * 5**n.valuation(5)
return Zmod(n // rad)(10).multiplicative_order()
[a(n) for n in range(1, 20)]
# F. Chapoton, May 03 2020
(Python)
from sympy import n_order, multiplicity
def A007732(n): return n_order(10, n//2**multiplicity(2, n)//5**multiplicity(5, n)) # Chai Wah Wu, Feb 07 2022
CROSSREFS
KEYWORD
nonn,base,easy,nice
AUTHOR
N. J. A. Sloane, Hal Sampson [ hals(AT)easynet.com ]
EXTENSIONS
More terms from James A. Sellers, Feb 05 2000
STATUS
approved