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 18 results. Next

A164960 The minimum number of steps needed to generate prime(n) under the map x -> A060264(x) starting from any x taken from {2,3} or from A164333.

Original entry on oeis.org

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

Views

Author

Vladimir Shevelev, Sep 02 2009

Keywords

Examples

			a(3) = 1 because prime(3)=5 can be generated in 1 step starting from x=2.
a(4) = 1 because prime(4)=7 can be generated in 1 step starting from x=3.
		

Crossrefs

Cf. A164333.

Programs

  • Maple
    # include source from A164333 and A060264 here
    A164333 := proc(n)
            if n = 1 then
                    13;
            else
                    for a from procname(n-1)+1 do
                            if isA164333(a) then
                                    return a;
                            end if;
                    end do;
            end if;
    end proc:
    A164960aux := proc(p,strt)
            local a,x;
            if strt > p then
                    return 1000000000;
            end if;
            a := 0 ;
            x := strt ;
            while x < p do
                    x := A060264(x) ;
                    a := a+1 ;
            end do;
            if x = p then
                    return a ;
            else
                    return 1000000000;
            end if;
    end proc:
    A164960 := proc(n)
            local p,a,strt,i;
            p := ithprime(n) ;
            a := A164960aux(p,2) ;
            a := min(a,A164960aux(p,3)) ;
            for i from 1 do
                    strt := A164333(i) ;
                    if strt > p then
                            return a;
                    else
                            a := min(a, A164960aux(p,strt)) ;
                    end if;
            end do:
            return a;
    end proc:
    seq(A164960(n),n=1..90) ; # R. J. Mathar, Oct 29 2011
  • Mathematica
    nmax = 100; kmax = nmax + 5;
    A164333 = Select[Table[{(Prime[k - 1] + 1)/2, (Prime[k] - 1)/2}, {k, 3, kmax}], AllTrue[Range[#[[1]], #[[2]]], CompositeQ] &][[All, 2]]*2 + 1;
    A164960aux[p_, strt_] := Module[{a, x}, If[strt > p, Return[10^9]]; a = 0; x = strt; While[x < p, x = NextPrime[2 x]; a++]; If[x == p, Return[a], Return[10^9]]];
    A164960[n_] := Module[{p, a, strt, i}, p = Prime[n]; a = A164960aux[p, 2]; a = Min[a, A164960aux[p, 3]]; For[i = 1, i < 100, i++, strt = A164333[[i]]; If[strt > p, Return[a], a = Min[a, A164960aux[p, strt]]]]; Return[a]];
    Table[A164960[n], {n, 1, nmax}] (* Jean-François Alcover, Dec 13 2017, after R. J. Mathar *)

Extensions

One term corrected, sequence extended, examples added by R. J. Mathar, Oct 29 2011

A118753 First prime after 4n. Smallest prime >= 4*n. Bisection of A060264.

Original entry on oeis.org

2, 5, 11, 13, 17, 23, 29, 29, 37, 37, 41, 47, 53, 53, 59, 61, 67, 71, 73, 79, 83, 89, 89, 97, 97, 101, 107, 109, 113, 127, 127, 127, 131, 137, 137, 149, 149, 149, 157, 157, 163, 167, 173, 173, 179, 181, 191, 191, 193, 197, 211, 211, 211, 223, 223, 223, 227, 229, 233
Offset: 0

Views

Author

Jonathan Vos Post, Apr 29 2006

Keywords

Comments

Analogous to A060264 First prime after 2n; A118751 First prime after 3n.

Crossrefs

Programs

  • Maple
    seq(nextprime(4*k),k=0..100); # Robert Israel, Dec 25 2017
  • Mathematica
    NextPrime/@(4Range[0,60]) (* Harvey P. Dale, Nov 14 2021 *)

Formula

a(n) = min{A008586(n)+k such that k>0 and A008586(n)+k in A000040}.

A055496 a(1) = 2; a(n) is smallest prime > 2*a(n-1).

Original entry on oeis.org

2, 5, 11, 23, 47, 97, 197, 397, 797, 1597, 3203, 6421, 12853, 25717, 51437, 102877, 205759, 411527, 823117, 1646237, 3292489, 6584983, 13169977, 26339969, 52679969, 105359939, 210719881, 421439783, 842879579, 1685759167, 3371518343
Offset: 1

Views

Author

N. J. A. Sloane, Jul 07 2000

Keywords

Comments

It appears that lim_{n->infinity} a(n)/2^n exists and is approximately 1.569985585.... - Franklin T. Adams-Watters, Nov 11 2011
This is a B_2 sequence. - Thomas Ordowski, Sep 23 2014 See the link.
Conjecture: lim_{n->infinity} a(n)/A006992(n) = 5.1648264... - Thomas Ordowski, Apr 05 2015

Crossrefs

Values of a(n)-2*a(n-1) in A163469. - Zak Seidov, Jul 28 2009
Cf. A065545 (with a(1)=3). - Zak Seidov, Feb 04 2016
Row 1 of A229608.

Programs

  • Maple
    A055496 := proc(n) option remember; if n=1 then 2 else nextprime(2*A055496(n-1)); fi; end;
  • Mathematica
    NextPrim[n_Integer] := Block[ {k = n + 1}, While[ !PrimeQ[k], k++ ]; Return[k]]; a[1] = 2; a[n_] := NextPrim[ 2*a[n - 1]]; Table[ a[n], {n, 1, 31} ]
    a[1]=2;a[n_]:=a[n]=Prime[PrimePi[2*a[n-1]]+1];Table[a[n],{n,40}] (* Zak Seidov, Feb 16 2006 *)
    NestList[ NextPrime[2*# ]&,2,100] (* Zak Seidov, Jul 28 2009 *)
  • PARI
    print1(a=2);for(n=2,20,print1(", ",a=nextprime(a+a))) \\ Charles R Greathouse IV, Jul 19 2011

Formula

a(n+1) = A060264(a(n)). - Peter Munn, Oct 23 2017

Extensions

Mathematica updated by Jean-François Alcover, Jun 19 2013

A020482 Greatest p with p, q both prime, p+q = 2n.

Original entry on oeis.org

2, 3, 5, 7, 7, 11, 13, 13, 17, 19, 19, 23, 23, 23, 29, 31, 31, 31, 37, 37, 41, 43, 43, 47, 47, 47, 53, 53, 53, 59, 61, 61, 61, 67, 67, 71, 73, 73, 73, 79, 79, 83, 83, 83, 89, 89, 89, 79, 97, 97, 101, 103, 103, 107, 109, 109, 113, 113, 113, 109, 113, 113, 109, 127, 127, 131, 131
Offset: 2

Views

Author

Keywords

Comments

a(n) = A171637(n,A035026(n)). - Reinhard Zumkeller, Mar 03 2014

Crossrefs

Programs

  • Haskell
    a020482 = last . a171637_row  -- Reinhard Zumkeller, Mar 03 2014
    
  • Mathematica
    a[n_] := {p, q} /. {ToRules @ Reduce[p+q == 2*n, {p, q}, Primes]} // Max; Table[a[n], {n, 2, 100}] (* Jean-François Alcover, Dec 19 2013 *)
    Table[Max[Flatten[Select[IntegerPartitions[2n,{2}],AllTrue[#,PrimeQ]&]]],{n,2,70}] (* Harvey P. Dale, Sep 04 2024 *)
  • PARI
    a(n)=forprime(q=2,n,if(isprime(2*n-q), return(2*n-q))) \\ Charles R Greathouse IV, Apr 28 2015
    
  • Python
    from sympy import primerange, isprime
    def A020482(n): return next(m for p in primerange(2*n) if isprime(m:=(n<<1)-p)) # Chai Wah Wu, Nov 19 2024

A060308 Largest prime <= 2n.

Original entry on oeis.org

2, 3, 5, 7, 7, 11, 13, 13, 17, 19, 19, 23, 23, 23, 29, 31, 31, 31, 37, 37, 41, 43, 43, 47, 47, 47, 53, 53, 53, 59, 61, 61, 61, 67, 67, 71, 73, 73, 73, 79, 79, 83, 83, 83, 89, 89, 89, 89, 97, 97, 101, 103, 103, 107, 109, 109, 113, 113, 113, 113, 113, 113, 113, 127, 127, 131
Offset: 1

Views

Author

Labos Elemer, Mar 27 2001

Keywords

Comments

a(n) is the smallest k such that C(2n,n) divides k!. - Benoit Cloitre, May 30 2002
a(n) is largest prime factor of C(2n,n) = (2n)!/(n!)^2. - Alexander Adamchuk, Jul 11 2006
a(n) is also the largest prime in the interval [n,2n]. - Peter Luschny, Mar 04 2011
Odd prime p repeats (q-p)/2 times, where q > p is the next prime. In particular, every lesser of twin primes (A001359) occurs 1 time, every lesser more than 3 of cousin primes (A023200) occurs 2 times, etc. - Vladimir Shevelev, Mar 12 2012

Examples

			n=1, 2n=2, p(1) = 2 = a(1) is the largest prime not exceeding 2.
		

Crossrefs

Apart from initial term, same as A060265.
Cf. A007917 (largest prime <= n), A005843 (2n).

Programs

Formula

a(n) = Max[FactorInteger[(2n)!/(n!)^2]]. - Alexander Adamchuk, Jul 11 2006
a(n) = A006530(A000142(2*n)) and a(n) = A006530(A056040(2*n)). - Peter Luschny, Mar 04 2011
a(n) ~ 2*n as n tends to infinity. - Vladimir Shevelev, Mar 12 2012
a(n) = A007917(A005843(n)) = A226078(n, A067434(n)). - Reinhard Zumkeller, May 25 2013

Extensions

More terms from Alexander Adamchuk, Jul 11 2006

A060266 Difference between 2n and the following prime.

Original entry on oeis.org

1, 1, 1, 3, 1, 1, 3, 1, 1, 3, 1, 5, 3, 1, 1, 5, 3, 1, 3, 1, 1, 3, 1, 5, 3, 1, 5, 3, 1, 1, 5, 3, 1, 3, 1, 1, 5, 3, 1, 3, 1, 5, 3, 1, 7, 5, 3, 1, 3, 1, 1, 3, 1, 1, 3, 1, 13, 11, 9, 7, 5, 3, 1, 3, 1, 5, 3, 1, 1, 9, 7, 5, 3, 1, 1, 5, 3, 1, 5, 3, 1, 3, 1, 5, 3, 1, 5, 3, 1, 1, 9, 7, 5, 3, 1, 1, 3, 1, 1, 11, 9, 7, 5
Offset: 1

Views

Author

Labos Elemer, Mar 23 2001

Keywords

Crossrefs

Programs

  • Maple
    with(numtheory): [seq(nextprime(2*i)-2*i,i=1..256)];
  • Mathematica
    d2n[n_]:=Module[{c=2n},NextPrime[c]-c]; Array[d2n,120] (* Harvey P. Dale, May 14 2011 *)
    Table[NextPrime@ # - # &[2 n], {n, 120}] (* Michael De Vlieger, Feb 18 2017 *)
  • PARI
    a(n) = nextprime(2*n+1) - 2*n; \\ Michel Marcus, Feb 19 2017

Formula

Conjecture: Limit_{n->oo} (Sum_{k=1..n} a(k)) / (Sum_{k=1..n} log(2*k)) = 1. - Alain Rocchelli, Oct 24 2023

A118750 a(n) = product[k=1..n] P(k), where P(k) is the largest prime <= 3*k. a(n) = product[k=1..n] A118749(k).

Original entry on oeis.org

3, 15, 105, 1155, 15015, 255255, 4849845, 111546435, 2565568005, 74401472145, 2306445636495, 71499814731345, 2645493145059765, 108465218947450365, 4664004414740365695, 219208207492797187665, 10302785752161467820255
Offset: 1

Views

Author

Jonathan Vos Post, Apr 29 2006

Keywords

Comments

Differs from (after first term) A048599 "Partial products of the sequence (A001097) of twin primes" after 8th term. Differs from (after first term) A070826 "One half of product of first n primes A000040" after 9th term. Analogous to A118455 a(1)=1. a(n) = product{k=1..n} P(k), where P(k) is the largest prime <= k.

Crossrefs

A097050 Smallest prime > n(n+1)/2.

Original entry on oeis.org

2, 2, 5, 7, 11, 17, 23, 29, 37, 47, 59, 67, 79, 97, 107, 127, 137, 157, 173, 191, 211, 233, 257, 277, 307, 331, 353, 379, 409, 439, 467, 499, 541, 563, 599, 631, 673, 709, 743, 787, 821, 863, 907, 947, 991, 1039, 1087, 1129, 1181, 1229, 1277, 1327, 1381, 1433, 1487, 1543
Offset: 0

Views

Author

N. J. A. Sloane, Sep 15 2004, Nov 21 2008

Keywords

Crossrefs

Cf. A060264. See A065383 for another version.

Programs

Formula

a(n) = A151800(A000217(n)). - Michel Marcus, Nov 13 2015

A060267 Difference between 2 closest primes surrounding 2n.

Original entry on oeis.org

2, 2, 4, 4, 2, 4, 4, 2, 4, 4, 6, 6, 6, 2, 6, 6, 6, 4, 4, 2, 4, 4, 6, 6, 6, 6, 6, 6, 2, 6, 6, 6, 4, 4, 2, 6, 6, 6, 4, 4, 6, 6, 6, 8, 8, 8, 8, 4, 4, 2, 4, 4, 2, 4, 4, 14, 14, 14, 14, 14, 14, 14, 4, 4, 6, 6, 6, 2, 10, 10, 10, 10, 10, 2, 6, 6, 6, 6, 6, 6, 4, 4, 6, 6, 6, 6, 6, 6, 2, 10, 10, 10, 10, 10, 2, 4
Offset: 2

Views

Author

Labos Elemer, Mar 23 2001

Keywords

Examples

			a(3) = 2 because the closest primes to 2*3 = 6 are (5,7) and the difference between these is 2. - _Michael De Vlieger_, Nov 02 2017
		

Crossrefs

Programs

  • Maple
    with(numtheory): [seq(nextprime(2*i)-prevprime(2*i),i=2..256)];
  • Mathematica
    Array[Subtract @@ NextPrime[#, {1, -1}] &[2 #] &, 96, 2] (* Michael De Vlieger, Nov 02 2017 *)
    NextPrime[#]-NextPrime[#,-1]&/@(2*Range[2,100]) (* Harvey P. Dale, Nov 07 2017 *)
  • PARI
    a(n) = nextprime(2*n+1) - precprime(2*n-1); \\ Michel Marcus, Sep 16 2020

A230504 Smallest prime in r(k) = r(k-1) + gcd(k,r(k-1)) with r(1) = n.

Original entry on oeis.org

2, 2, 3, 19, 5, 19, 7, 11, 11, 17, 11, 17, 13, 17, 17, 23, 17, 23, 19, 23, 23, 29, 23, 29, 29, 29, 29, 37, 29, 37, 31, 37, 37, 53, 53, 53, 37, 41, 41, 47, 41, 47, 43, 47, 47, 53, 47, 53, 53, 53, 53, 59, 53, 59, 59, 59, 59, 67, 59, 67, 61, 67, 67, 79, 79, 79
Offset: 1

Views

Author

Reinhard Zumkeller, Nov 15 2013

Keywords

Comments

a(p) = p, p prime;
a(2*n-1) = A060264(n-1).

Examples

			n = 1 -> 1 + GCD(1,2) = 1+1 = 2 = prime(1) = a(1);
n = 2 = prime(1) = a(2);
n = 3 = prime(2) = a(3);
n = 4 -> 4+GCD(4,2) = 4+2 = 6 -> 6+GCD(6,3) = 6+3 = 9 -> 9+GCD(9,4) = 9+1 = 10 -> 10+GCD(10,5) = 10+5 = 15 -> 15+GCD(15,6) = 15+3 = 18 -> 18+GCD(18,7) = 18+1 = 19 = prime(8) = a(4) = A084662(7);
n = 5 = prime(3) = a(5) = A134736(1);
n = 6 -> 6+GCD(6,2) = 6+2 = 8 -> 8+GCD(8,3) = 8+1 = 9 -> 9+GCD(9,4) = 9+1 = 10 -> 10+GCD(10,5) = 10+5 = 15 -> 15+GCD(15,6) = 15+3 = 18 -> 18+GCD(18,7) = 18+1 = 19 = prime(8) = a(6);
n = 7 = prime(4) = a(7) = A106108(1);
n = 8 -> 8+GCD(8,2) = 8+2 = 10 -> 10+GCD(10,3) = 10+1 = 11 = prime(5) = a(8) = A084663(3);
n = 9 -> 9+GCD(9,2) = 9+2 = 11 = prime(5) = a(9);
n = 10 -> 10+GCD(10,2) = 10+2 = 12 -> 12+GCD(12,3) = 12+3 = 15 -> 15+GCD(15,4) = 15+1 = 16 -> 16+GCD(16,5) = 16+1 = 17 = prime(7) = a(10);
n = 11 = prime(5) = a(11);
n = 12 -> 12+GCD(12,2) = 12+2 = 14 -> 14+GCD(14,3) = 14+1 = 15 -> 15+GCD(15,4) = 15+1 = 16 -> 16+GCD(16,5) = 16+1 = 17 = prime(7) = a(10).
		

Crossrefs

Programs

  • Haskell
    a230504 n = head $ filter ((== 1) . a010051') rs where
                       rs = n : zipWith (+) rs (zipWith gcd rs [2..])
    
  • Mathematica
    a[n_] := Module[{r}, If[PrimeQ[n], n, r[1]=n; r[k_] := r[k] = r[k-1] + GCD[k, r[k-1]]; For[k=1, True, k++, If[PrimeQ[r[k]], Return[r[k]]]]]];
    Array[a, 66] (* Jean-François Alcover, Dec 03 2018 *)
  • Python
    from math import gcd
    from itertools import count, accumulate
    from sympy import isprime
    def A230504(n): return next(filter(isprime,accumulate(count(2),lambda x,y:x+gcd(x,y),initial=n))) # Chai Wah Wu, Mar 15 2023
Showing 1-10 of 18 results. Next