A023512 Exponent of 2 in prime factorization of prime(n) + 1.
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, 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, 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
Offset: 1
Examples
a(9) = 3 because the 9th prime is 23 and the largest power of 2 dividing 24 is 3.
Links
- Amiram Eldar, Table of n, a(n) for n = 1..10000 (terms 1..2261 from K. G. Stier)
Programs
-
Magma
[Valuation(NthPrime(n)+1, 2): n in [1..110]]; // Bruno Berselli, Aug 05 2013
-
Maple
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
-
Mathematica
Join[{0}, Table[FactorInteger[Prime[n] + 1][[1]][[2]], {n, 2, 100}]] (* Clark Kimberling, Oct 01 2013 *) IntegerExponent[Prime[Range[100]] + 1, 2] (* Zak Seidov, Apr 25 2014 *)
-
PARI
a(n)=valuation(prime(n)+1,2); vector(100,n,a(n)) \\ Joerg Arndt, Mar 11 2014
Formula
Extensions
Corrected by Yasutoshi Kohmoto, Feb 25 2005
Edited by N. J. A. Sloane, Dec 23 2006
Comments