%I #40 Sep 19 2020 10:31:44
%S 1,2,3,3,3,6,3,5,3,6,3,9,3,6,9,5,3,6,3,9,9,6,3,15,3,6,3,9,3,18,3,5,9,
%T 6,9,9,3,6,9,15,3,18,3,9,9,6,3,15,3,6,9,9,3,6,9,15,9,6,3,27,3,6,9,5,9,
%U 18,3,9,9,18
%N a(n) = number of solutions to x^3 - x == 0 (mod n).
%C Shadow transform of A007531. - _Michel Marcus_, Jun 06 2013
%C a(n) = 3 iff n belongs to (A061345 \ {1}) Union {4}. - _Bernard Schott_, Sep 16 2019
%H Eric M. Schmidt, <a href="/A087688/b087688.txt">Table of n, a(n) for n = 1..10000</a>
%H Lorenz Halbeisen and Norbert Hungerbuehler, <a href="https://www.semanticscholar.org/paper/Number-theoretic-aspects-of-a-combinatorial-Halbeisen-Hungerb%C3%BChler/5743ff2f9c14d22d1a9e570d6951a7c9ef79a612">Number theoretic aspects of a combinatorial function</a>, Notes on Number Theory and Discrete Mathematics 5(4) (1999), 138-150; see Definition 7 for the shadow transform.
%H N. J. A. Sloane, <a href="/transforms.txt">Transforms</a>.
%F Multiplicative with a(p^e) = 3 for p an odd prime, a(2^1) = 2, a(2^2) = 3, a(2^e) = 5 for e >= 3. - _Eric M. Schmidt_, Apr 08 2013
%p A087688 := proc(n) local a,x ; a := 0 ; for x from 0 to n-1 do if (x*(x^2-1)) mod n = 0 then a := a+1 ; end if; end do; a ; end proc:
%p seq(A087688(n),n=1..70) ; # _R. J. Mathar_, Jan 07 2011
%t nsols[n_]:=Length[Select[Range[0,n-1],Mod[#^3-#,n]==0&]]; nsols/@Range[80] (* _Harvey P. Dale_, Mar 22 2011 *)
%t f[2, e_] := Which[e == 1, 2, e == 2, 3, e >= 3, 5]; f[p_, e_] := 3; a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* _Amiram Eldar_, Sep 19 2020 *)
%o (PARI) a(n)=if(n%2,3^omega(n),my(v=valuation(n,2));3^omega(n>>v)*[2,3,5][min(3,v)]) \\ _Charles R Greathouse IV_, Mar 22 2011
%Y Cf. A034444, A224516, A060594.
%K mult,nonn,easy
%O 1,2
%A Yuval Dekel (dekelyuval(AT)hotmail.com), Sep 27 2003