%I #46 Jan 20 2026 20:20:06
%S 0,1,1,1,1,1,1,0,1,1,1,0,1,1,0,0,1,1,1,0,0,1,1,0,1,1,1,0,1,0,1,0,0,1,
%T 0,0,1,1,0,0,1,0,1,0,0,1,1,0,1,1,0,0,1,1,0,0,0,1,1,0,1,1,0,0,0,0,1,0,
%U 0,0,1,0,1,1,0,0,0,0,1,0,1,1,1,0,0,1,0,0,1,0,0,0,0,1,0,0,1,1,0,0,1,0,1,0,0
%N Characteristic sequence of numbers n having a primitive root modulo n.
%C a(1) = 0, since we have an empty set of numbers more than 0 and less than 1.
%C If A(x) is the counting function of a(n)=1, n<=x, then A(x)~2*x/log(x) as x tends to infinity.
%C Characteristic function of A033948 (apart from the initial term). - _Antti Karttunen_, Aug 22 2017
%H Antti Karttunen, <a href="/A211487/b211487.txt">Table of n, a(n) for n = 1..65537</a>
%H <a href="/index/Ch#char_fns">Index entries for characteristic functions</a>
%F a(n) = 1 iff n = 2, 4, p^k, 2*p^k, where p is an odd prime.
%F A001783(n) == (-1)^a(n) mod n.
%F From _Antti Karttunen_, Aug 22 2017: (Start)
%F For n > 1, if A034380(n) = 1, a(n) = 1, otherwise a(n) = 0.
%F A103131(n) = (-1)^a(n) for n > 2.
%F (End)
%o (PARI) A211487(n) = if(n%2, !!isprimepower(n), (n==2 || n==4 || (isprimepower(n/2, &n) && n>2))); \\ _Antti Karttunen_, Aug 22 2017, after _Charles R Greathouse IV_'s code for A033948.
%Y Cf. A001783, A033948, A034380, A103131.
%K nonn
%O 1
%A _Vladimir Shevelev_, May 13 2012
%E More terms from _Antti Karttunen_, Aug 22 2017