cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-1 of 1 results.

A023512 Exponent of 2 in prime factorization of prime(n) + 1.

Original entry on oeis.org

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

Views

Author

Keywords

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

Examples

			a(9) = 3 because the 9th prime is 23 and the largest power of 2 dividing 24 is 3.
		

Crossrefs

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

a(n) = A007814(A008864(n)). - Amiram Eldar, Mar 14 2025

Extensions

Corrected by Yasutoshi Kohmoto, Feb 25 2005
Edited by N. J. A. Sloane, Dec 23 2006
Showing 1-1 of 1 results.