%I #72 Feb 26 2025 08:56:23
%S 2,2,2,3,2,4,4,4,2,8,6,4,4,4,8,12,2,4,16,4,4,12,8,4,8,16,16,20,4,8,48,
%T 4,4,24,16,32,16,8,16,12,4,8,64,4,8,64,32,8,8,8,64,48,8,8,64,48,8,24,
%U 8,16,16,4,32,64,4,64,64,8,12,24,96,8,32,8,32,96,16,64,768,4,8,192,32,64
%N Number of divisors of 2^n + 1.
%C a(n) is odd iff n = 3, as a consequence of the Catalan-Mihăilescu theorem. - _Bernard Schott_, Oct 05 2021
%H Max Alekseyev, <a href="/A046798/b046798.txt">Table of n, a(n) for n = 0..1123</a> (terms 0..500 from T. D. Noe, terms 501..1062 from Amiram Eldar, term 1108 from Tyler Busby)
%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Catalan%27s_conjecture">Catalan's conjecture</a>.
%F a(n) = A000005(A000051(n)). - _Michel Marcus_, Mar 18 2017
%e a(7)=4, because 2^7 + 1 = 129 has 4 divisors.
%p a:= n-> numtheory[tau](2^n+1):
%p seq(a(n), n=0..100); # _Alois P. Heinz_, Aug 23 2021
%t A046798[n_IntegerQ]:=DivisorSigma[0,1+2^n]; (* _Enrique Pérez Herrero_, Nov 09 2010 *)
%t DivisorSigma[0, 1 + 2^#] & /@ Range[0, 83] (* _Jayanta Basu_, Jun 29 2013 *)
%t Table[DivisorSigma[0, 2^n + 1], {n, 0, 100}] (* _Vincenzo Librandi_, Feb 05 2018 *)
%o (PARI) a(n) = numdiv(2^n+1); \\ _Michel Marcus_, Mar 18 2017
%o (Python)
%o from sympy.ntheory import divisor_count
%o def A046798(n): return divisor_count(2**n + 1) # _Indranil Ghosh_, Mar 18 2017
%o (Magma) [NumberOfDivisors(2^n+1): n in [0..100]]; // _Vincenzo Librandi_, Feb 05 2018
%Y Cf. A000005, A000051, A002587, A002589, A046801, A054992, A057957, A059886, A274906, A344897.
%K nonn,changed
%O 0,1
%A _Labos Elemer_