OFFSET
1,2
COMMENTS
2^a(n) is the largest power of 2 dividing (prime(n)+1).
By Dirichlet's theorem on arithmetic progressions, the asymptotic density of primes p such that p == 2^k-1 (mod 2^k) within all the primes is 1/2^(k-1), for k >= 1. This is also the asymptotic density of terms in this sequence that are >= k. Therefore, the asymptotic density of the occurrences of k in this sequence is d(k) = 1/2^(k-1) - 1/2^k = 1/2^k, and the asymptotic mean of this sequence is Sum_{k>=1} k*d(k) = 2. - Amiram Eldar, Mar 14 2025
LINKS
Amiram Eldar, Table of n, a(n) for n = 1..10000 (terms 1..2261 from K. G. Stier)
FORMULA
EXAMPLE
a(9) = 3 because the 9th prime is 23 and the largest power of 2 dividing 24 is 3.
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 *)
PROG
(Magma) [Valuation(NthPrime(n)+1, 2): n in [1..110]]; // Bruno Berselli, Aug 05 2013
(PARI) a(n)=valuation(prime(n)+1, 2);
vector(100, n, a(n)) \\ Joerg Arndt, Mar 11 2014
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
EXTENSIONS
Corrected by Yasutoshi Kohmoto, Feb 25 2005
Edited by N. J. A. Sloane, Dec 23 2006
STATUS
approved
