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-10 of 10 results.

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

Original entry on oeis.org

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, 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, 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
Offset: 1

Views

Author

Keywords

Comments

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
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
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
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

Examples

			For n = 25, prime(25) = 97, A006093(25) = 96 = 2*2*2*2*2*3, so a(25) = 5.
		

Crossrefs

Subsequence of A001511 (except 1st term).

Programs

  • Magma
    [Valuation(NthPrime(n)-1, 2): n in [1..110]]; // Bruno Berselli, Aug 05 2013
    
  • Maple
    A023506:= x -> padic[ordp](ithprime(x)-1,2):
    seq(A023506(x),x=1..1000); # Robert Israel, May 06 2014
  • Mathematica
    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 *)
    Table[IntegerExponent[Prime[n] - 1, 2], {n, 110}] (* Bruno Berselli, Aug 05 2013 *)
  • 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
    
  • PARI
    forprime(p=2, 700, print1(valuation(p-1,2),", ")); \\ Bruno Berselli, Aug 05 2013
    
  • Python
    from sympy import prime
    def A023506(n): return (~(m:=prime(n)-1)& m-1).bit_length() # Chai Wah Wu, Jul 07 2022

Formula

A091282 Exponent of 2 in prime(n)^2 - 1.

Original entry on oeis.org

0, 3, 3, 4, 3, 3, 5, 3, 4, 3, 6, 3, 4, 3, 5, 3, 3, 3, 3, 4, 4, 5, 3, 4, 6, 3, 4, 3, 3, 5, 8, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 3, 7, 7, 3, 4, 3, 6, 3, 3, 4, 5, 5, 3, 9, 4, 3, 5, 3, 4, 3, 3, 3, 4, 4, 3, 3, 5, 3, 3, 6, 4, 5, 3, 3, 8, 3, 3, 5, 4, 3, 3, 5, 5, 4, 3, 7, 4, 3, 5, 3, 6, 4, 3, 3, 4, 3, 4, 3, 3, 3, 3, 3, 4, 3
Offset: 1

Views

Author

Labos Elemer, Jan 20 2004

Keywords

Comments

Also, exponent of 2 in -1+prime(n)^s if s is an exponent of the form 4k+2 (previous definition). - Michel Marcus, Dec 20 2013
Primes that give records for this sequence can be found in A233930. - Michel Marcus, Dec 20 2013

Examples

			a(1)=0 since -1+2^s is always odd...
		

Crossrefs

Programs

  • Mathematica
    IntegerExponent[Prime[Range[100]]^2 - 1, 2] (* Amiram Eldar, Jun 06 2024 *)
  • PARI
    a(n) = valuation(prime(n)^2-1, 2); \\ Michel Marcus, Dec 20 2013

Formula

a(n) = A023506(n) + A023512(n). - Amiram Eldar, Jun 06 2024

Extensions

Definition modified by Michel Marcus, Dec 20 2013

A057024 Largest odd factor of (n-th prime+1); k when n-th prime is written as k*2^m-1 [with k odd].

Original entry on oeis.org

3, 1, 3, 1, 3, 7, 9, 5, 3, 15, 1, 19, 21, 11, 3, 27, 15, 31, 17, 9, 37, 5, 21, 45, 49, 51, 13, 27, 55, 57, 1, 33, 69, 35, 75, 19, 79, 41, 21, 87, 45, 91, 3, 97, 99, 25, 53, 7, 57, 115, 117, 15, 121, 63, 129, 33, 135, 17, 139, 141, 71, 147, 77, 39, 157, 159, 83, 169, 87
Offset: 1

Views

Author

Henry Bottomley, Jul 24 2000

Keywords

Comments

a(n) = 1 if and only if prime(n) is a Mersenne prime. - Ely Golden, Feb 06 2017

Examples

			a(5)=3 because 5th prime is 11 and 11=3*2^2-1.
		

Crossrefs

Programs

  • Magma
    A057024:= func< n | (NthPrime(n)+1)/2^Valuation(NthPrime(n)+1, 2) >;
    [A057024(n): n in [1..100]]; // G. C. Greubel, Aug 06 2024
  • Mathematica
    Table[Max[Select[Divisors[Prime[n]+1],OddQ]],{n,100}] (* Daniel Jolly, Nov 15 2014 *)
  • PARI
    a(n) = (prime(n)+1)/2^valuation(prime(n)+1, 2); \\ Michel Marcus, Feb 05 2017
    
  • Sage
    def a(n):
        x=nth_prime(n)+1
        return x/2**((int(x)&int(-x)).bit_length()-1)
    index=1
    while(index<=10000):
        print(str(index)+" "+str(a(index)))
        index+=1
    # Ely Golden, Feb 06 2017
    

Formula

a(n) = A000265(A000040(n) + 1) = A000265(A028815(n)).
a(n) = (A000040(n) + 1)/A007814(A000040(n) + 1).
a(n) = A028815(n)/A023512(n).

A227990 3^a(n) is the highest power of 3 dividing prime(n)+1.

Original entry on oeis.org

1, 0, 1, 0, 1, 0, 2, 0, 1, 1, 0, 0, 1, 0, 1, 3, 1, 0, 0, 2, 0, 0, 1, 2, 0, 1, 0, 3, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 2, 0, 1, 0, 2, 0, 0, 0, 1, 0, 2, 1, 0, 2, 1, 1, 3, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 2, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 3, 0, 0, 1, 2
Offset: 1

Views

Author

Bruno Berselli, Aug 05 2013

Keywords

Comments

This is the 3-adic valuation of prime(n)+1.
By Dirichlet's theorem on arithmetic progressions, the asymptotic density of primes p such that p == 3^k-1 (mod 3^k) within all the primes is 1/(2*3^(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*3^(k-1)) - 1/(2*3^k) = 1/3^k, and the asymptotic mean of this sequence is Sum_{k>=1} k*d(k) = 3/4. - Amiram Eldar, Mar 14 2025

Crossrefs

Cf. A007949, A008864, A023512 (2-adic valuation of prime(n)+1), A099584 (3-adic valuation of prime(n)-1), A227991 (associated powers of 3).

Programs

  • Magma
    [Valuation(NthPrime(n)+1, 3): n in [1..100]];
  • Mathematica
    Table[IntegerExponent[Prime[n] + 1, 3], {n, 100}]
  • PARI
    forprime(p=2, 700, print1(valuation(p+1,3),", "));
    

Formula

a(n) = A007949(A008864(n)).

A068504 Highest power of 2 dividing prime(n)+1.

Original entry on oeis.org

1, 4, 2, 8, 4, 2, 2, 4, 8, 2, 32, 2, 2, 4, 16, 2, 4, 2, 4, 8, 2, 16, 4, 2, 2, 2, 8, 4, 2, 2, 128, 4, 2, 4, 2, 8, 2, 4, 8, 2, 4, 2, 64, 2, 2, 8, 4, 32, 4, 2, 2, 16, 2, 4, 2, 8, 2, 16, 2, 2, 4, 2, 4, 8, 2, 2, 4, 2, 4, 2, 2, 8, 16, 2, 4, 128, 2, 2, 2, 2, 4, 2, 16, 2, 8, 4, 2, 2, 2, 16, 4, 32, 8, 4, 4, 8, 2
Offset: 1

Views

Author

Benoit Cloitre, Mar 11 2002

Keywords

Crossrefs

Programs

  • Maple
    f:= n -> 2^padic:-ordp(ithprime(n)+1,2):
    map(f, [$1..100]); # Robert Israel, Jan 13 2017
  • Mathematica
    a[n_] := 2^IntegerExponent[Prime[n] + 1, 2]; Array[a, 100] (* Amiram Eldar, Jun 04 2022 *)
  • PARI
    a(n) = 2^valuation(prime(n)+1, 2); \\ Michel Marcus, Nov 24 2013
    
  • Python
    from sympy import prime
    def A068504(n): return (m:=prime(n)+1)&-m # Chai Wah Wu, Jul 09 2022

Formula

a(n) = A006519(A008864(n)). - Michel Marcus, Nov 24 2013
a(n) = 2^A023512(n). - Michel Marcus, Nov 24 2013

A239114 Exponent of 2 in prime factorization (i.e., 2-adic valuation) of odd nonprimes A014076(n) + 1.

Original entry on oeis.org

1, 1, 4, 1, 1, 2, 1, 2, 3, 1, 1, 2, 3, 1, 6, 1, 1, 2, 1, 1, 1, 3, 2, 1, 5, 2, 1, 4, 2, 1, 3, 1, 2, 1, 1, 1, 3, 1, 4, 1, 2, 1, 2, 5, 1, 1, 1, 2, 4, 1, 3, 1, 2, 1, 2, 1, 2, 1, 4, 1, 1, 3, 1, 2, 1, 1, 3, 2, 1, 2, 1, 3, 1, 1, 8, 2, 1, 1, 2, 1, 2, 3, 1, 5, 1, 2, 3, 1, 2, 1, 4, 1, 1, 2, 6, 1, 2, 1, 3, 1
Offset: 1

Views

Author

K. G. Stier, Mar 10 2014

Keywords

Comments

Sequence is counterpart to A023512, i.e., merging these two sequences gives the ruler function A001511.

Examples

			a(13) = 3, because the 13th odd nonprime is 55, and the largest power of 2 dividing 55+1 is 3.
		

Crossrefs

Programs

  • PARI
    lista(nn) = {forstep(n=1, nn, 2, if (! isprime(n), print1(valuation(n+1, 2), ", ")););} \\ Michel Marcus, Mar 13 2014

Formula

a(n) = A001511((A014076(n)+1)/2)

A241541 Exponent of 11 in prime factorization of (2^n + 3^n + 5^n + 7^n).

Original entry on oeis.org

0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2
Offset: 0

Views

Author

Zak Seidov, Apr 25 2014

Keywords

Comments

11^a(n) is the largest power of 11 dividing (2^n + 3^n + 5^n + 7^n);
(2^n + 3^n + 5^n + 7^n) is divisible by 11^2 = 121 for n == 5 mod 10.
Among first 10000 nonzero terms there are {8182, 1652, 150, 14, 1, 1} terms with values {2, 3, 4, 5, 6, 7}, respectively.
Record values are a(5) = 2, a(45) = 3, a(595) = 5, a(40525) = 7, a(6482565) = 8, a(97435855) = 9, a(927694285) = 10, a(11789738455) = 11, a(129687123005) = 12, a(508958242255) = 13, a(11921425066695) = 14, a(74689992601115) = 15, a(1110371356919045) = 16, a(20886240847078255) = 17, a(229748649317860805) = 18, etc. - Charles R Greathouse IV, Apr 25 2014

Examples

			at n = 5, 2^n + 3^n + 5^n + 7^n = 20207 = 11^2*167,
at n = 15, 2^n + 3^n + 5^n + 7^n = 4778093469743 = 11^2*587*67271509.
		

Crossrefs

Programs

  • Mathematica
    Table[IntegerExponent[2^n + 3^n + 5^n + 7^n, 11], {n, 0, 100}]
  • PARI
    a(n)=valuation(2^n+3^n+5^n+7^n,11) \\ Charles R Greathouse IV, Apr 25 2014
    
  • PARI
    a(n,e=8)=my(m=11^e, o=valuation(Mod(2,m)^n +Mod(3,m)^n +Mod(5,m)^n +Mod(7,m)^n, 11)); if(oCharles R Greathouse IV, Apr 25 2014

A363017 a(n) is the least integer k such that the k-th, (k+1)-th, ..., (k+n-1)-th primes are congruent to 3 mod 8.

Original entry on oeis.org

2, 94, 334, 4422, 23969, 303493, 303493, 606529, 28725046, 92865581, 397316305, 511883558, 848516256, 23738949809, 144899085865, 469694200388, 3800553021301, 8571139291304, 63858322306341, 90990757864814
Offset: 1

Views

Author

Léo Gratien, May 13 2023

Keywords

Comments

a(n) is also the minimal rank where n consecutive 2's appear in A023512.
The sequence is infinite by Shiu's theorem.

Examples

			For n=2, a(2) = 94 because prime(94)+1 = 492 = 4*123, prime(95)+1 = 500 = 4*125 are the first two consecutive primes p such that p+1 is divisible by 4 and not by 8.
		

Crossrefs

Cf. A363016 (with 1 mod 4).

Formula

a(n) = primepi(A057632(n)). - Amiram Eldar, May 13 2023

Extensions

a(19)-a(20) from Martin Ehrenstein, May 28 2023

A363016 a(n) is the least integer k such that the k-th, (k+1)-th, ..., (k+n-1)-th primes are congruent to 1 mod 4.

Original entry on oeis.org

3, 6, 24, 77, 378, 1395, 1395, 1395, 1395, 31798, 61457, 240748, 800583, 804584, 804584, 804584, 16118548, 16138563, 16138563, 56307979, 56307979, 56307979, 56307979, 56307979, 3511121443, 3511121443, 26284355567, 26284355567, 26284355567, 118027458557, 118027458557, 118027458557, 118027458557
Offset: 1

Views

Author

Léo Gratien, May 13 2023

Keywords

Comments

a(n) is also the minimal rank where n consecutive 1's appear in A023512.
The sequence is infinite by Shiu's theorem.

Examples

			For n=3, a(3) = 24 because prime(24)+1=90, prime(25)+1=98, and prime(26)+1=102 are the first 3 consecutive primes p such that p+1 is divisible by 2 and not by 4.
		

Crossrefs

Cf. A363017 (3 mod 8).

Formula

a(n) = A000720(A057624(n)). - Amiram Eldar, May 13 2023

A227471 Position of first 0 in the binary representation of prime(n), starting the count of positions at 1 for the least significant bit.

Original entry on oeis.org

1, 3, 2, 4, 3, 2, 2, 3, 4, 2, 6, 2, 2, 3, 5, 2, 3, 2, 3, 4, 2, 5, 3, 2, 2, 2, 4, 3, 2, 2, 8, 3, 2, 3, 2, 4, 2, 3, 4, 2, 3, 2, 7, 2, 2, 4, 3, 6, 3, 2, 2, 5, 2, 3, 2, 4, 2, 5, 2, 2, 3, 2, 3, 4, 2, 2, 3, 2, 3, 2, 2, 4, 5, 2, 3, 8, 2, 2, 2, 2, 3, 2, 5, 2, 4, 3, 2, 2, 2
Offset: 1

Views

Author

Juri-Stepan Gerasimov, Jul 12 2013

Keywords

Comments

If no zero appears in the base-2 representation, the search "falls through" and addresses the (virtual) leading zero of that prime, see A035100. - R. J. Mathar, Jul 20 2013

Crossrefs

Formula

a(n) = 1+A023512(n). - Antti Karttunen, Jul 13 2013
Showing 1-10 of 10 results.