login
Number of odd divisors of prime(n) - 1.
1

%I #21 Oct 11 2024 13:20:30

%S 1,1,1,2,2,2,1,3,2,2,4,3,2,4,2,2,2,4,4,4,3,4,2,2,2,3,4,2,4,2,6,4,2,4,

%T 2,6,4,5,2,2,2,6,4,2,3,6,8,4,2,4,2,4,4,4,1,2,2,8,4,4,4,2,6,4,4,2,8,4,

%U 2,4,2,2,4,4,8,2,2,6,3,4,4,8,4,4,4,4,2,4,4,8,2,2,6,6,4

%N Number of odd divisors of prime(n) - 1.

%C a(n) is odd if and only if prime(n) is in A249410. - _Jianing Song_, Nov 14 2021

%H Robert Israel, <a href="/A349273/b349273.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) = A001227(A006093(n)).

%p nod:= n -> numtheory:-tau(n/2^padic:-ordp(n,2)):

%p map(nod, [seq(ithprime(i)-1,i=1..100)]); # _Robert Israel_, Oct 11 2024

%t a[n_] := DivisorSigma[0, (k = Prime[n] - 1)/2^IntegerExponent[k, 2]]; Array[a, 100] (* _Amiram Eldar_, Jun 03 2021 *)

%t Count[Divisors[#-1],_?OddQ]&/@Prime[Range[100]] (* _Harvey P. Dale_, Jan 22 2024 *)

%o (Magma) [NumberOfDivisors(p-1)/Valuation(2*p-2, 2): p in PrimesUpTo(500)];

%o (Python)

%o from sympy import divisors, prime

%o def a(n): return sum(d%2 for d in divisors(prime(n)-1))

%o print([a(n) for n in range(1, 96)]) # _Michael S. Branicky_, Jul 04 2021

%o (PARI) a(n) = sumdiv(prime(n)-1, d, d%2); \\ _Michel Marcus_, Dec 18 2021

%Y Cf. A000040, A001227, A006093, A249410.

%K nonn,easy

%O 1,4

%A _Juri-Stepan Gerasimov_, Nov 12 2021