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

A145025 Numbers which are the average of two consecutive odd primes (A024675) together with primes which are the average of the previous prime and the following prime (A006562).

Original entry on oeis.org

4, 5, 6, 9, 12, 15, 18, 21, 26, 30, 34, 39, 42, 45, 50, 53, 56, 60, 64, 69, 72, 76, 81, 86, 93, 99, 102, 105, 108, 111, 120, 129, 134, 138, 144, 150, 154, 157, 160, 165, 170, 173, 176, 180, 186, 192, 195, 198, 205, 211, 217, 225, 228, 231, 236, 240, 246, 254, 257, 260
Offset: 1

Views

Author

Keywords

Comments

Numbers n such that prevprime(n) + nextprime(n) = 2n. - Wesley Ivan Hurt, May 13 2017

Crossrefs

Equals A024675 U A006562. - M. F. Hasler, Jun 01 2013

Programs

  • Maple
    Primes:= select(isprime, [seq(i,i=3..1000,2)]):
    nprimes:= nops(Primes):
    A024675:= {seq((Primes[i]+Primes[i+1])/2, i=1..nprimes-1)}:
    L:= Primes[1..-3]+Primes[3..-1]:
    A006562:=zip((s,t) -> if 2*s=t then s else NULL fi, Primes[2..-2],L):
    sort(convert(convert(A006562,set) union A024675, list)); # Robert Israel, Nov 20 2016
  • Mathematica
    Union[Select[Map[Mean@ {First@ #, Last@ #} &, Partition[#, 3, 1]], PrimeQ], Map[Mean, Partition[#, 2, 1]]] &@ Prime@ Range[2, 56] (* Michael De Vlieger, Jan 31 2019 *)
  • PARI
    for(n=2,999,n-precprime(n-1)==nextprime(n+1)-n&&print1(n",")) \\ M. F. Hasler, Jun 01 2013

Extensions

Entry revised by N. J. A. Sloane, Mar 24 2017, replacing old definition with definition from M. F. Hasler

A127557 Decimal expansion of the number 5.018865657377378233714156283... having continued fraction expansion 5, 53, 157, 173, 211, 257, 263, 373, 563, ... (balanced primes order one A006562).

Original entry on oeis.org

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

Views

Author

Artur Jasinski, Jan 18 2007

Keywords

Crossrefs

Programs

  • Mathematica
    a = {}; Do[If[PrimeQ[((Prime[n + 2] + Prime[n + 1])/2 + (Prime[n + 1] + Prime[n])/2)/2], AppendTo[a, ((Prime[n + 2] + Prime[n + 1])/2 + (Prime[n + 1] + Prime[n])/2)/2]], {n, 1, 1000}]; RealDigits[N[FromContinuedFraction[a], 100]][[1]]

A225496 Numbers having no balanced prime factors, cf. A006562.

Original entry on oeis.org

1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17, 18, 19, 21, 22, 23, 24, 26, 27, 28, 29, 31, 32, 33, 34, 36, 37, 38, 39, 41, 42, 43, 44, 46, 47, 48, 49, 51, 52, 54, 56, 57, 58, 59, 61, 62, 63, 64, 66, 67, 68, 69, 71, 72, 73, 74, 76, 77, 78, 79, 81, 82, 83, 84
Offset: 1

Views

Author

Reinhard Zumkeller, May 09 2013

Keywords

Comments

a(n) = A047201(n) for n <= 42.

Examples

			a(40) = 49 = 7^2 = A178943(3)^2;
a(41) = 51 = 3 * 17 = A178943(2) * A178943(6);
a(42) = 52 = 2^2 * 13 = A178943(1)^2 * A178943(5);
a(43) = 54 = 2 * 3^3 = A178943(1) * A178943(2)^3;
a(44) = 56 = 2^3 * 7 = A178943(1)^3 * A178943(3);
a(45) = 57 = 3 * 19 = A178943(2) * A178943(7).
		

Crossrefs

Cf. A225493 (strong), A225494 (balanced), A225495 (weak).

Programs

  • Haskell
    import Data.Set (singleton, fromList, union, deleteFindMin)
    a225496 n = a225496_list !! (n-1)
    a225496_list = 1 : h (singleton p) ps [p] where
       (p:ps) = a178943_list
       h s xs'@(x:xs) ys
         | m > x     = h (s `union` (fromList $ map (* x) (1 : ys))) xs ys
         | otherwise = m : h (s' `union` (fromList $ map (* m) ys')) xs' ys'
         where ys' = m : ys; (m, s') = deleteFindMin s

Formula

Multiplicative closure of A178943; a(n) mod A006562(k) > 0 for all k.

A178943 Primes that are not balanced primes (see A006562).

Original entry on oeis.org

2, 3, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 163, 167, 179, 181, 191, 193, 197, 199, 223, 227, 229, 233, 239, 241, 251, 269, 271, 277, 281, 283, 293
Offset: 1

Views

Author

Paul Muljadi, Dec 30 2010

Keywords

Crossrefs

Complement with respect to A000040 gives A006562.
Union of {2}, A051634 and A051634; A225496 (multiplicative closure).

Programs

  • Haskell
    a178943 n = a178943_list !! (n-1)
    a178943_list = 2 : h a000040_list where
       h (p:qs@(q:r:ps)) = if 2 * q /= (p + r) then q : h qs else h qs
    -- Reinhard Zumkeller, May 09 2013
  • Mathematica
    Transpose[ Select[ Partition[ Prime@ Range@ 65, 3, 1],#[[2]]!=(#[[1]]+#[[3]])/2&]][[2]]

A225494 Numbers having only balanced prime factors, cf. A006562.

Original entry on oeis.org

1, 5, 25, 53, 125, 157, 173, 211, 257, 263, 265, 373, 563, 593, 607, 625, 653, 733, 785, 865, 947, 977, 1055, 1103, 1123, 1187, 1223, 1285, 1315, 1325, 1367, 1511, 1747, 1753, 1865, 1907, 2287, 2417, 2677, 2809, 2815, 2903, 2963, 2965, 3035, 3125, 3265, 3307
Offset: 1

Views

Author

Reinhard Zumkeller, May 09 2013

Keywords

Crossrefs

Cf. A225493 (strong), A225495 (weak), A225496 (non-balanced).

Programs

  • Haskell
    import Data.Set (singleton, fromList, union, deleteFindMin)
    a225494 n = a225494_list !! (n-1)
    a225494_list = 1 : h (singleton p) ps [p] where
       (p:ps) = a006562_list
       h s xs'@(x:xs) ys
         | m > x     = h (s `union` (fromList $ map (* x) (1 : ys))) xs ys
         | otherwise = m : h (s' `union` (fromList $ map (* m) ys')) xs' ys'
         where ys' = m : ys; (m, s') = deleteFindMin s

Formula

Multiplicative closure of A006562.

A145024 Number of primes between successive balanced primes (A006562).

Original entry on oeis.org

3, 13, 21, 3, 7, 8, 1, 18, 29, 5, 3, 8, 11, 31, 4, 20, 3, 7, 5, 19, 21, 32, 1, 19, 48, 19, 29, 32, 7, 38, 1, 43, 12, 33, 46, 6, 16, 8, 4, 34, 15, 1, 19, 7, 1, 23, 28, 30, 22, 8, 1, 7, 1, 52, 14, 56, 10, 26, 2, 30, 65, 5, 71, 12, 44, 39, 37, 6, 19, 47, 11, 10, 21, 7, 11, 4, 62, 7, 4, 8, 1
Offset: 1

Views

Author

Keywords

Programs

  • Mathematica
    BalancedPrimeQ[n_]:=Prime[n+1]-Prime[n]==Prime[n]-Prime[n-1]; lst={}; a=1; Do[If[BalancedPrimeQ[n], i=PrimePi[p=Prime[n]]-PrimePi[a]; AppendTo[lst,i]; a=p],{n,2,5000}]; lst

A036263 Second differences of primes.

Original entry on oeis.org

1, 0, 2, -2, 2, -2, 2, 2, -4, 4, -2, -2, 2, 2, 0, -4, 4, -2, -2, 4, -2, 2, 2, -4, -2, 2, -2, 2, 10, -10, 2, -4, 8, -8, 4, 0, -2, 2, 0, -4, 8, -8, 2, -2, 10, 0, -8, -2, 2, 2, -4, 8, -4, 0, 0, -4, 4, -2, -2, 8, 4, -10, -2, 2, 10, -8, 4, -8, 2, 2, 2, -2, 0, -2, 2, 2, -4, 4, 2, -8, 8, -8, 4, -2, 2, 2, -4, -2, 2, 8, -4
Offset: 1

Views

Author

Keywords

Examples

			a(3) = 5 + 11 - 2*7 = 16 - 14 = 2.
		

Crossrefs

For records see A293154, A293155.

Programs

  • Haskell
    a036263 n = a036263_list !! (n-1)
    a036263_list = zipWith (-) (tail a001223_list) a001223_list
    -- Reinhard Zumkeller, Oct 29 2011
    
  • Maple
    A036263:=n->ithprime(n) + ithprime(n+2) - 2*ithprime(n+1); seq(A036263(n), n=1..100); # Wesley Ivan Hurt, Apr 01 2014
  • Mathematica
    Table[Prime[n - 1] + Prime[n + 1] - 2*Prime[n], {n, 2, 105}]
    Differences[Prime[Range[100]], 2] (* Harvey P. Dale, Oct 14 2012 *)
  • PARI
    for(n=2,100,print1(prime(n+2)-2*prime(n+1)+prime(n)","))
    
  • Python
    from sympy import prime
    def A036263(n): return prime(n)-(prime(n+1)<<1)+prime(n+2) # Chai Wah Wu, Sep 28 2024

Formula

a(A064113(n)) = 0. - Reinhard Zumkeller, Jan 20 2012
a(n) = prime(n) + prime(n+2) - 2*prime(n+1). - Thomas Ordowski, Jul 21 2012
Conjecture: |a(1)| + |a(2)| + ... + |a(n)| ~ prime(n). - Thomas Ordowski, Jul 21 2012
a(n) = A001223(n+1) - A001223(n). - R. J. Mathar, Sep 19 2013
Sum_{i = 1..n - 1} a(i) = A046933(n), n >= 1. - Daniel Forgues, Apr 15 2014
Sum_{i = 2..n - 1} a(i) = prime(n + 1) - prime(n) - 2; Sum_{i = 2..n - 1} a(i) = 0 whenever prime(n) is a lesser of twin primes. - Hamdi Murat Yildirim, Jun 24 2014

A024675 Average of two consecutive odd primes.

Original entry on oeis.org

4, 6, 9, 12, 15, 18, 21, 26, 30, 34, 39, 42, 45, 50, 56, 60, 64, 69, 72, 76, 81, 86, 93, 99, 102, 105, 108, 111, 120, 129, 134, 138, 144, 150, 154, 160, 165, 170, 176, 180, 186, 192, 195, 198, 205, 217, 225, 228, 231, 236, 240, 246, 254, 260, 266, 270, 274, 279, 282, 288, 300
Offset: 1

Views

Author

Keywords

Comments

Sometimes called interprimes.
Where local maxima of A072681 occur: A072681(a(n))=A074927(n+1). - Reinhard Zumkeller, Mar 04 2009
Never prime, for that would contradict the definition. - Jon Perry, Dec 05 2012
A subset of A145025, obtained from that sequence by omitting the primes (which are barycenter of their neighboring primes). - M. F. Hasler, Jun 01 2013
Conjecture: Product_{k=1..n} a(k)/A028334(k+1) is an integer for every natural n. Cf. A352743. - Thomas Ordowski, Mar 31 2022
In contrast to the arithmetic mean, the geometric and the harmonic mean of two consecutive primes is never an integer. What is the first case where either of the two would differ from the arithmetic mean, i.e., this sequence? The existence of such a pair of primes is related to Legendre's conjecture, cf. link to discussion on the math-fun mailing list. - M. F. Hasler, Apr 07 2025

Crossrefs

Cf. A072568, A072569. Bisections give A058296, A079424.
Cf. A373699 (partial sums).

Programs

  • Maple
    seq( ( (ithprime(x)+ithprime(x+1))/2 ),x=2..40);
  • Mathematica
    Plus @@@ Partition[Table[Prime[n], {n, 2, 100}], 2, 1]/2
    ListConvolve[{1, 1}/2, Prime /@ Range[2, 70]] (* Jean-François Alcover, Jun 25 2013 *)
    Mean/@Partition[Prime[Range[2,70]],2,1] (* Harvey P. Dale, Jul 28 2020 *)
  • PARI
    for(X=2,50,print((prime(X)+prime(X+1))/2)) \\ Hauke Worpel (thebigh(AT)outgun.com), May 08 2008
    
  • PARI
    first(n)=my(v=primes(n+2)); vector(n,i,v[i+1]+v[i+2])/2 \\ Charles R Greathouse IV, Jun 25 2013
    
  • Python
    from sympy import prime
    def a(n): return (prime(n + 1) + prime(n + 2)) // 2
    print([a(n) for n in range(1, 101)]) # Indranil Ghosh, Jul 11 2017

Formula

a(n) = (prime(n+1)+prime(n+2))/2 = A001043(n+1)/2. - Omar E. Pol, Feb 02 2012
Conjecture: a(n) = ceiling(sqrt(prime(n+1)*prime(n+2))). - Thomas Ordowski, Mar 22 2013 [This requires gaps to be smaller than approximately sqrt(8p) and hence requires a result on prime gaps slightly stronger than that provided by the Riemann hypothesis. - Charles R Greathouse IV, Jul 13 2022]
Equals A145025 \ A006562 = A145025 \ A000040. - M. F. Hasler, Jun 01 2013

A029707 Numbers n such that the n-th and the (n+1)-st primes are twin primes.

Original entry on oeis.org

2, 3, 5, 7, 10, 13, 17, 20, 26, 28, 33, 35, 41, 43, 45, 49, 52, 57, 60, 64, 69, 81, 83, 89, 98, 104, 109, 113, 116, 120, 140, 142, 144, 148, 152, 171, 173, 176, 178, 182, 190, 201, 206, 209, 212, 215, 225, 230, 234, 236, 253, 256, 262, 265, 268, 277
Offset: 1

Views

Author

N. J. A. Sloane, Dec 11 1999

Keywords

Comments

Numbers m such that prime(m)^2 == 1 mod (prime(m) + prime(m + 1)). - Zak Seidov, Sep 18 2013
First differences are A027833. The complement is A049579. - Gus Wiseman, Dec 03 2024

Crossrefs

Cf. A014574, A027833 (first differences), A007508. Equals PrimePi(A001359) (cf. A000720).
The complement is A049579, first differences A251092 except first term.
Lengths of runs of terms differing by 2 are A179067.
The first differences have run-lengths A373820 except first term.
A000040 lists the primes, differences A001223 (run-lengths A333254, A373821).
A038664 finds the first prime gap of 2n.
A046933 counts composite numbers between primes.
For prime runs: A005381, A006512, A025584, A067774.

Programs

  • Maple
    A029707 := proc(n)
        numtheory[pi](A001359(n)) ;
    end proc:
    seq(A029707(n),n=1..30); # R. J. Mathar, Feb 19 2017
  • Mathematica
    Select[ Range@300, PrimeQ[ Prime@# + 2] &] (* Robert G. Wilson v, Mar 11 2007 *)
    Flatten[Position[Flatten[Differences/@Partition[Prime[Range[100]],2,1]], 2]](* Harvey P. Dale, Jun 05 2014 *)
  • Sage
    def A029707(n) :
       a = [ ]
       for i in (1..n) :
          if (nth_prime(i+1)-nth_prime(i) == 2) :
             a.append(i)
       return(a)
    A029707(277) # Jani Melik, May 15 2014

Formula

a(n) = A107770(n) - 1. - Juri-Stepan Gerasimov, Dec 16 2009

A064113 Indices k such that (1/3)*(prime(k)+prime(k+1)+prime(k+2)) is a prime.

Original entry on oeis.org

2, 15, 36, 39, 46, 54, 55, 73, 102, 107, 110, 118, 129, 160, 164, 184, 187, 194, 199, 218, 239, 271, 272, 291, 339, 358, 387, 419, 426, 464, 465, 508, 520, 553, 599, 605, 621, 629, 633, 667, 682, 683, 702, 709, 710, 733, 761, 791, 813, 821, 822, 829, 830
Offset: 1

Views

Author

Jason Earls, Sep 08 2001

Keywords

Comments

n such that d(n) = d(n+1), where d(n) = prime(n+1) - prime(n) = A001223(n).
Of interest because when I generalize it to d(n) = d(n+2), d(n) = d(n+3), etc. I am unable to find any positive number k such that d(n) = d(n+k) has no solution.
From Lei Zhou, Dec 06 2005: (Start)
When (1/3)*(prime(k) + prime(k+1) + prime(k+2)) is prime, then it is equal to prime(k+1).
Also, indices k such that (prime(k)+prime(k+2))/2 = prime(k+1).
The Mathematica program is based on the alternative definition. (End)
Inflection and undulation points of the primes, i.e., positions of zeros in A036263, the second differences of the primes. - Gus Wiseman, Mar 24 2020

Examples

			a(2) = 15 because (p(15)+p(16)+p(17)) = 1/3(47 + 53 + 59) = 53 (prime average of three successive primes).
Splitting the prime gaps into anti-runs gives: (1,2), (2,4,2,4,2,4,6,2,6,4,2,4,6), (6,2,6,4,2,6,4,6,8,4,2,4,2,4,14,4,6,2,10,2,6), (6,4,6), ... Then a(n) is the n-th partial sum of the lengths of these anti-runs. - _Gus Wiseman_, Mar 24 2020
		

Crossrefs

Indices of zeros in A036263 (second differences of primes).
Indices (A000720 = primepi) of balanced primes A006562, minus 1.
Cf. A262138.
Complement of A333214.
First differences are A333216.
The version for strict ascents is A258025.
The version for strict descents is A258026.
The version for weak ascents is A333230.
The version for weak descents is A333231.
A triangle for anti-runs of compositions is A106356.
Lengths of maximal runs of prime gaps are A333254.
Anti-runs of compositions in standard order are A333381.

Programs

  • Haskell
    import Data.List (elemIndices)
    a064113 n = a064113_list !! (n-1)
    a064113_list = map (+ 1) $ elemIndices 0 a036263_list
    -- Reinhard Zumkeller, Jan 20 2012
    
  • Mathematica
    ct = 0; Do[If[(Prime[k] + Prime[k + 2] - 2*Prime[k + 1]) == 0, ct++; n[ct] = k], {k, 1, 2000}]; Table[n[k], {k, 1, ct}] (* Lei Zhou, Dec 06 2005 *)
    Join@@Position[Differences[Array[Prime,100],2],0] (* Gus Wiseman, Mar 24 2020 *)
  • PARI
    d(n) = prime(n+1)-prime(n); j=[]; for(n=1,1500, if(d(n)==d(n+1), j=concat(j,n))); j
    
  • PARI
    { n=0; for (m=1, 10^9, if (d(m)==d(m+1), write("b064113.txt", n++, " ", m); if (n==1000, break)) ) } \\ Using d(n) above. - Harry J. Smith, Sep 07 2009
    
  • PARI
    [n | n<-[1..888], !A036263(n)] \\ M. F. Hasler, Oct 15 2024
    
  • PARI
    \\ More efficient for larges range of n:
    A064113_upto(N, n=1, L=List(), q=prime(n+1), d=q-prime(n))={forprime(p=1+q,, if(d==d=p-q, listput(L,n); #LM. F. Hasler, Oct 15 2024
    
  • Python
    from itertools import count, islice
    from sympy import prime, nextprime
    def A064113_gen(startvalue=1): # generator of terms >= startvalue
        c = max(startvalue,1)
        p = prime(c)
        q = nextprime(p)
        r = nextprime(q)
        for k in count(c):
            if p+r==(q<<1):
                yield k
            p, q, r = q, r, nextprime(r)
    A064113_list = list(islice(A064113_gen(),20)) # Chai Wah Wu, Feb 27 2024

Formula

A036263(a(n)) = 0; A122535(n) = A000040(a(n)); A006562(n) = A000040(a(n) + 1); A181424(n) = A000040(a(n) + 2). - Reinhard Zumkeller, Jan 20 2012
A262138(2*a(n)) = 0. - Reinhard Zumkeller, Sep 12 2015
a(n) = A000720(A006562(n)) - 1, where A000720 = (prime)pi, A006562 = balanced primes. - M. F. Hasler, Oct 15 2024
Showing 1-10 of 150 results. Next