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.

A023506 Exponent of 2 in prime factorization of prime(n) - 1.

This page as a plain text file.
%I A023506 #56 Mar 14 2025 09:00:55
%S A023506 0,1,2,1,1,2,4,1,1,2,1,2,3,1,1,2,1,2,1,1,3,1,1,3,5,2,1,1,2,4,1,1,3,1,
%T A023506 2,1,2,1,1,2,1,2,1,6,2,1,1,1,1,2,3,1,4,1,8,1,2,1,2,3,1,2,1,1,3,2,1,4,
%U A023506 1,2,5,1,1,2,1,1,2,2,4,3,1,2,1,4,1,1,6,3,2,1,1,1,1,1,1,1,2,3,1,2,1,2,1,3,1
%N A023506 Exponent of 2 in prime factorization of prime(n) - 1.
%C A023506 Also the number of steps to reach an integer starting with prime(n)/2 and iterating the map x->x*ceiling(x). - _Benoit Cloitre_, Sep 06 2002
%C A023506 Also exponent of 2 in -1 + prime(n)^s for odd exponents s because (-1 + prime(n)^s)/(prime(n) - 1) is odd. - _Labos Elemer_, Jan 20 2004
%C A023506 First occurrence of 0,1,2,3,4,...: 1, 2, 3, 13, 7, 25, 44, 116, 55, 974, 1581, 2111, 1470, 4289, 10847, 15000, 6543, 91466, 62947, 397907, 498178, ..., for primes 2, 3, 5, 41, 17, 97, 193, 641, 257, 7681, 13313, 18433, 12289, 40961, 114689, 163841, 65537, 1179649, 786433, 5767169, 7340033, .... - _Robert G. Wilson v_, May 28 2009
%C A023506 By Dirichlet's theorem on arithmetic progressions, the asymptotic density of primes p such that p == 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 A023506 Robert Israel, <a href="/A023506/b023506.txt">Table of n, a(n) for n = 1..10000</a>
%F A023506 a(n) = A007814(A000010(A000040(n))) = A007814(A006093(n)).
%e A023506 For n = 25, prime(25) = 97, A006093(25) = 96 = 2*2*2*2*2*3, so a(25) = 5.
%p A023506 A023506:= x -> padic[ordp](ithprime(x)-1,2):
%p A023506 seq(A023506(x),x=1..1000); # _Robert Israel_, May 06 2014
%t A023506 f[n_] := Block[{fi = First@ FactorInteger[ Prime@n - 1]}, If[ fi[[1]] == 2, fi[[2]], 0]]; Array[f, 105] (* _Robert G. Wilson v_, May 28 2009 *)
%t A023506 Table[IntegerExponent[Prime[n] - 1, 2], {n, 110}] (* _Bruno Berselli_, Aug 05 2013 *)
%o A023506 (PARI) A023506(n) = {local(m,r);r=0;m=prime(n)-1;while(m%2==0,m=m/2;r++);r} \\ _Michael B. Porter_, Jan 26 2010
%o A023506 (PARI) forprime(p=2, 700, print1(valuation(p-1,2),", ")); \\ _Bruno Berselli_, Aug 05 2013
%o A023506 (Magma) [Valuation(NthPrime(n)-1, 2): n in [1..110]]; // _Bruno Berselli_, Aug 05 2013
%o A023506 (Python)
%o A023506 from sympy import prime
%o A023506 def A023506(n): return (~(m:=prime(n)-1)& m-1).bit_length() # _Chai Wah Wu_, Jul 07 2022
%Y A023506 Cf. A007814, A000010, A000040, A006093, A023512, A057023, A057773 (partial sums).
%Y A023506 Subsequence of A001511 (except 1st term).
%K A023506 nonn,easy
%O A023506 1,3
%A A023506 _Clark Kimberling_