|
|
A063994
|
|
a(n) = Product_{primes p dividing n } gcd(p-1, n-1).
|
|
28
|
|
|
1, 1, 2, 1, 4, 1, 6, 1, 2, 1, 10, 1, 12, 1, 4, 1, 16, 1, 18, 1, 4, 1, 22, 1, 4, 1, 2, 3, 28, 1, 30, 1, 4, 1, 4, 1, 36, 1, 4, 1, 40, 1, 42, 1, 8, 1, 46, 1, 6, 1, 4, 3, 52, 1, 4, 1, 4, 1, 58, 1, 60, 1, 4, 1, 16, 5, 66, 1, 4, 3, 70, 1, 72, 1, 4, 3, 4, 1, 78, 1, 2, 1, 82, 1, 16, 1, 4, 1, 88, 1, 36, 1
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,3
|
|
COMMENTS
|
a(n) = number of bases b modulo n for which b^{n-1} == 1 (mod n).
Note that a(n) = phi(n) iff n = 1 or n is prime or n is Carmichael number A002997. - Thomas Ordowski, Dec 17 2013
|
|
LINKS
|
R. Baillie and S. S. Wagstaff, Lucas pseudoprimes, Mathematics of Computation, 35 (1980), 1391-1417.
|
|
FORMULA
|
a(p^m) = p-1 and a(2p^m) = 1 for prime p and integer m > 0. - Thomas Ordowski, Dec 15 2013
a(n) = Sum_{k=1..n}(floor((k^(n-1)-1)/n)-floor((k^(n-1)-2)/n)). - Anthony Browne, May 11 2016
|
|
MATHEMATICA
|
f[n_] := Times @@ GCD[n - 1, First /@ FactorInteger@ n - 1]; f[1] = 1; Array[f, 92] (* Robert G. Wilson v, Aug 08 2011 *)
|
|
PROG
|
(PARI) for (n=1, 1000, f=factor(n)~; a=1; for (i=1, length(f), a*=gcd(f[1, i] - 1, n - 1)); write("b063994.txt", n, " ", a) ) \\ Harry J. Smith, Sep 05 2009
(Python)
def a(n):
if n == 1: return 1
return len([1 for witness in range(1, n) if pow(witness, n - 1, n) == 1])
[a(n) for n in range(1, 100)]
(Haskell)
a063994 n = product $ map (gcd (n - 1) . subtract 1) $ a027748_row n
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,easy,nice
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|