Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #28 Sep 08 2022 08:44:47
%S 0,2,1,3,2,1,1,2,3,1,5,1,1,2,4,1,2,1,2,3,1,4,2,1,1,1,3,2,1,1,7,2,1,2,
%T 1,3,1,2,3,1,2,1,6,1,1,3,2,5,2,1,1,4,1,2,1,3,1,4,1,1,2,1,2,3,1,1,2,1,
%U 2,1,1,3,4,1,2,7,1,1,1,1,2,1,4,1,3,2,1,1,1,4,2,5,3,2,2,3,1,1,2,1,2,1,2,1,2
%N Exponent of 2 in prime factorization of prime(n) + 1.
%C 2^a(n) is the largest power of 2 dividing (prime(n)+1).
%H K. G. Stier, <a href="/A023512/b023512.txt">Table of n, a(n) for n = 1..2261</a>
%e a(9)=3 because the 9th prime is 23 and the largest power of 2 dividing 24 is 3.
%p with(numtheory): a:=proc(n) local div,s,j,c: div:=divisors(1+ithprime(n)): s:=nops(div): for j from 1 to s do if type(simplify(log[2](div[j])), integer)=true then c[j]:=simplify(log[2](div[j])) else c[j]:=0 fi od: max(seq(c[j],j=1..s)) end: seq(a(n),n=1..120); # most probably not the simplest Maple program - _Emeric Deutsch_, Jul 20 2005
%t Join[{0}, Table[FactorInteger[Prime[n] + 1][[1]][[2]], {n, 2, 100}]] (* _Clark Kimberling_, Oct 01 2013 *)
%t IntegerExponent[Prime[Range[100]] + 1, 2] (* _Zak Seidov_, Apr 25 2014 *)
%o (Magma) [Valuation(NthPrime(n)+1, 2): n in [1..110]]; // _Bruno Berselli_, Aug 05 2013
%o (PARI) a(n)=valuation(prime(n)+1,2);
%o vector(100,n,a(n)) \\ _Joerg Arndt_, Mar 11 2014
%Y Cf. A239114.
%K nonn
%O 1,2
%A _Clark Kimberling_
%E Corrected by _Yasutoshi Kohmoto_, Feb 25 2005
%E Edited by _N. J. A. Sloane_, Dec 23 2006