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.

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

This page as a plain text file.
%I A023512 #38 Mar 14 2025 09:00:51
%S A023512 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 A023512 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 A023512 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 A023512 Exponent of 2 in prime factorization of prime(n) + 1.
%C A023512 2^a(n) is the largest power of 2 dividing (prime(n)+1).
%C A023512 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
%H A023512 Amiram Eldar, <a href="/A023512/b023512.txt">Table of n, a(n) for n = 1..10000</a> (terms 1..2261 from K. G. Stier)
%F A023512 a(n) = A007814(A008864(n)). - _Amiram Eldar_, Mar 14 2025
%e A023512 a(9) = 3 because the 9th prime is 23 and the largest power of 2 dividing 24 is 3.
%p A023512 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 A023512 Join[{0}, Table[FactorInteger[Prime[n] + 1][[1]][[2]], {n, 2, 100}]] (* _Clark Kimberling_, Oct 01 2013 *)
%t A023512 IntegerExponent[Prime[Range[100]] + 1, 2] (* _Zak Seidov_, Apr 25 2014 *)
%o A023512 (Magma) [Valuation(NthPrime(n)+1, 2): n in [1..110]]; // _Bruno Berselli_, Aug 05 2013
%o A023512 (PARI) a(n)=valuation(prime(n)+1,2);
%o A023512 vector(100,n,a(n)) \\ _Joerg Arndt_, Mar 11 2014
%Y A023512 Cf. A007814, A008864, A023506, A239114.
%K A023512 nonn,easy
%O A023512 1,2
%A A023512 _Clark Kimberling_
%E A023512 Corrected by _Yasutoshi Kohmoto_, Feb 25 2005
%E A023512 Edited by _N. J. A. Sloane_, Dec 23 2006