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.

A020481 Least p with p, q both prime, p+q = 2n.

Original entry on oeis.org

2, 3, 3, 3, 5, 3, 3, 5, 3, 3, 5, 3, 5, 7, 3, 3, 5, 7, 3, 5, 3, 3, 5, 3, 5, 7, 3, 5, 7, 3, 3, 5, 7, 3, 5, 3, 3, 5, 7, 3, 5, 3, 5, 7, 3, 5, 7, 19, 3, 5, 3, 3, 5, 3, 3, 5, 3, 5, 7, 13, 11, 13, 19, 3, 5, 3, 5, 7, 3, 3, 5, 7, 11, 11, 3, 3, 5, 7, 3, 5, 7, 3, 5, 3, 5, 7, 3, 5, 7, 3, 3, 5, 7, 11, 11, 3, 3, 5, 3, 3, 5, 7
Offset: 2

Views

Author

Keywords

Comments

Essentially the same as A002373, which does not have the a(2) term. - T. D. Noe, Sep 24 2007
a(n) = A171637(n,1). - Reinhard Zumkeller, Mar 03 2014
Conjecture: a(n) ~ O(n^1/2). - Jon Perry, Apr 29 2014

Crossrefs

Cf. A020482.

Programs

  • Haskell
    a020481 n = head [p | p <- a000040_list, a010051' (2 * n - p) == 1]
    -- Reinhard Zumkeller, Jul 07 2014, Mar 03 2014
    
  • Mathematica
    a[n_] := For[p = 2, True, p = NextPrime[p], If[PrimeQ[2n-p], Return[p]]];
    Table[a[n], {n, 2, 103}] (* Jean-François Alcover, Jul 31 2018  *)
  • PARI
    A020481(n) = {local(np);np=1;while(!isprime(2*n-prime(np)),np++);prime(np)} \\ Michael B. Porter, Dec 11 2009
    
  • PARI
    A020481(n)=forprime(p=1,n,isprime(2*n-p)&return(p)) \\ M. F. Hasler, Sep 18 2012
    
  • Python
    from sympy import isprime, primerange
    def A020481(n): return next(filter(lambda p:isprime((n<<1)-p),primerange(2*n))) # Chai Wah Wu, Nov 19 2024

Formula

a(n) = n - A047949(n). - Jason Kimberley, Oct 09 2012

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

A035026 Number of times that i and 2n-i are both prime, for i = 1, ..., 2n-1.

Original entry on oeis.org

0, 1, 1, 2, 3, 2, 3, 4, 4, 4, 5, 6, 5, 4, 6, 4, 7, 8, 3, 6, 8, 6, 7, 10, 8, 6, 10, 6, 7, 12, 5, 10, 12, 4, 10, 12, 9, 10, 14, 8, 9, 16, 9, 8, 18, 8, 9, 14, 6, 12, 16, 10, 11, 16, 12, 14, 20, 12, 11, 24, 7, 10, 20, 6, 14, 18, 11, 10, 16, 14, 15, 22, 11, 10, 24, 8, 16, 22, 9, 16, 20, 10
Offset: 1

Views

Author

Gordon R. Bower (siegmund(AT)mosquitonet.com)

Keywords

Comments

a(n) is the convolution of terms 1 to 2n of the characteristic function of the primes, A010051, with itself. Related to Goldbach's conjecture that every even number can be expressed as the sum of two primes. - T. D. Noe, Aug 01 2002
The following sequences all appear to have the same parity (with an extra zero term at the start of A010051): A010051, A061007, A035026, A069754, A071574. - Jeremy Gardiner, Aug 09 2002
Total number of printer jobs in all possible schedules for n time slots in the first-come-first-served (FCFS) policy.
a(n) = Sum_{p prime < 2*n} A010051(2*n - p). - Reinhard Zumkeller, Oct 19 2011
For n > 1: length of n-th row of triangle A171637. - Reinhard Zumkeller, Mar 03 2014
a(n) = A001221(A238711(n)) = A238778(n) / n. - Reinhard Zumkeller, Mar 06 2014
From Robert G. Wilson v, Dec 15 2016: (Start)
First occurrence of k: 1, 2, 4, 5, 8, 11, 12, 17, 18, 37, 24, 53, 30, 89, 39, 71, 42, 101, 45, 179, 57, 137, 72, 193, 60, 233, ..., .
Conjectured last occurrence of k: 1, 3, 6, 19, 34, 31, 64, 61, 76, 79, 94, 83, 166, 199, 136, 181, 184, 229, 244, 271, 316, 277, 346, 313, 301, 293, ..., .
Conjectured number occurrences of k: 1, 2, 2, 3, 6, 3, 8, 4, 7, 5, 11, 5, 11, 8, 10, 3, 17, 7, 16, 3, 13, 8, 21, 4, 12, 3, 22, 7, 20, 8, 15, ..., .
Records: 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 18, 20, 24, 26, 28, 38, 42, 48, 54, 60, 64, 82, 88, 102, 104, 114, 116, 136, 146, 152, 166, 182, ..., .
(End)

Crossrefs

Cf. A010051. Essentially the same as A002372.
Cf. A073610.

Programs

  • Haskell
    a035026 n = sum $ map (a010051 . (2 * n -)) $
       takeWhile (< 2 * n) a000040_list
    -- Reinhard Zumkeller, Oct 19 2011
  • Maple
    A035026 := proc(n)
        local a,i ;
        a := 0 ;
        for i from 1 to 2*n-1 do
            if isprime(i) and isprime(2*n-i) then
                a := a+1 ;
            end if;
        end do:
        a ;
    end proc: # R. J. Mathar, Jul 01 2013
  • Mathematica
    For[lst={}; n=1, n<=100, n++, For[cnt=0; i=1, i<=2n-1, i++ If[PrimeQ[i]&&PrimeQ[2n-i], cnt++ ]]; AppendTo[lst, cnt]]; lst
    f[n_] := Block[{c = Boole@ PrimeQ[ n/2], p = 2}, While[ 2p < n, If[ PrimeQ[n - p], c += 2]; p = NextPrime@ p]; c];; Array[ f[ 2#] &, 90] (* Robert G. Wilson v, Dec 15 2016 *)

Formula

For n > 1, a(n) = 2*A045917(n) - A010051(n).
a(n) = A010051(n) + 2*A061357(n). - Wesley Ivan Hurt, Aug 21 2013
a(n) = A073610(2*n). - Ridouane Oudra, Sep 06 2023

Extensions

Corrected by T. D. Noe, May 05 2002

A184995 Irregular triangle T, read by rows, in which row n lists the primes p <= n such that 2n-p is also prime.

Original entry on oeis.org

2, 3, 3, 3, 5, 5, 3, 7, 3, 5, 5, 7, 3, 7, 3, 5, 11, 5, 7, 11, 3, 7, 13, 5, 11, 7, 11, 13, 3, 13, 3, 5, 11, 17, 5, 7, 13, 17, 7, 19, 3, 11, 17, 5, 11, 13, 19, 3, 7, 13, 3, 5, 17, 23, 5, 7, 11, 17, 19, 3, 7, 13, 19, 5, 11, 23, 7, 11, 13, 17, 23, 3, 13, 19, 5, 11, 17, 29, 7, 13, 17, 19, 23, 29
Offset: 2

Views

Author

Jason Kimberley, Sep 03 2011

Keywords

Comments

Row n has first entry A020481(n), length A045917(n), and last entry A112823(n).
Each row is the prefix to the middle of the corresponding row of A171637.
The Goldbach conjecture states that this irregular Goldbach triangle has in each row at least one entry (A045917(n) >= 1). - Wolfdieter Lang, May 14 2016

Examples

			The irregular triangle T(n, i) starts:
n, 2*n\i  1   2   3   4   5   6 ...
2,   4    2
3,   6    3
4,   8    3
5,  10    3   5
6,  12    5
7,  14    3   7
8,  16    3   5
9,  18    5   7
10, 20    3   7
11, 22    3   5  11
12, 24    5   7  11
13, 26    3   7  13
14, 28    5  11
15, 30    7  11  13
16, 32    3  13
17, 34    3   5  11  17
18, 36    5   7  13  17
19, 38    7  19
20, 40    3  11  17
21, 42    5  11  13  19
22, 44    3   7  13
23, 46    3   5  17  23
24, 48    5   7  11  17  19
25, 50    3   7  13  19
26, 52    5  11  23
27, 54    7  11  13  17  23
28, 56    3  13  19
29, 58    5  11  17  29
30, 60    7  13  17  19  23  29
... reformatted - _Wolfdieter Lang_, May 14 2016
		

Crossrefs

Programs

  • Magma
    A184995 := func;
    &cat[A184995(n):n in [2..30]];
  • Maple
    T:= n-> seq(`if`(andmap(isprime, [p, 2*n-p]), p, NULL), p=2..n):
    seq(T(n), n=2..40);  # Alois P. Heinz, Jan 09 2025
  • Mathematica
    Table[Select[Prime@ Range@ PrimePi@ n, PrimeQ[2 n - #] &], {n, 2, 30}] // Flatten (* Michael De Vlieger, May 14 2016 *)
    T[n_] := Table[If[PrimeQ[p] && PrimeQ[2n-p], p, Nothing], {p, 2, n}];
    Table[T[n], {n, 2, 30}] // Flatten (* Jean-François Alcover, Jan 09 2025, after Alois P. Heinz in A182138 *)

Formula

T(n,i) = n - A182138(n,i). - Jason Kimberley, Sep 25 2012

A238711 Product of all primes p such that 2n - p is also prime.

Original entry on oeis.org

2, 3, 15, 105, 35, 231, 2145, 5005, 4641, 53295, 1616615, 119301, 21505, 7436429, 21489, 57998985, 3038795305, 4123, 13844919, 10393190665, 12838371, 299859855, 7292509103495, 12023917269, 70691995, 37198413949697, 62483343, 2769282065, 98755025688454681
Offset: 2

Views

Author

Reinhard Zumkeller, Mar 06 2014

Keywords

Comments

Product of n-th row in triangle A171637;
All terms greater than 3 are odd, composite and squarefree numbers, cf. A024556.
n is prime iff n is a factor of a(n).
Product of the distinct primes in the Goldbach partitions of 2n. - Wesley Ivan Hurt, Sep 29 2020

Crossrefs

Cf. A000040, A010051, A238778, subsequence of A056911.

Programs

  • Haskell
    a238711 n = product $ filter ((== 1) . a010051') $
       map (2 * n -) $ takeWhile (<= 2 * n) a000040_list
  • Mathematica
    Table[Times@@Select[Select[Prime[Range[2 n]], # < 2 n &], PrimeQ[2 n - #] &], {n, 2, 30}] (* Robert Price, Apr 26 2025 *)

Formula

A020639(a(n)) = A020481(n); A006530(a(n)) = A020482(n);
A001221(a(n)) = A035026(n); A008472(a(n)) = A238778(n);
A027748(a(n),k) + A027748(a(n),l+1-k) = 2*n for k=1..l, with l=A001221(a(n)); particulary A020639(a(n))+A006530(a(n)) = 2*n;
a(n) = n^c(n) * Product_{i=1..n-1} (i*(2*n-i))^(c(i)*c(2*n-i)), where c is the prime characteristic (A010051). - Wesley Ivan Hurt, Sep 29 2020

A238778 Sum of all primes p such that 2n - p is also a prime.

Original entry on oeis.org

2, 3, 8, 15, 12, 21, 32, 36, 40, 55, 72, 65, 56, 90, 64, 119, 144, 57, 120, 168, 132, 161, 240, 200, 156, 270, 168, 203, 360, 155, 320, 396, 136, 350, 432, 333, 380, 546, 320, 369, 672, 387, 352, 810, 368, 423, 672, 294, 600, 816, 520, 583, 864, 660, 784
Offset: 2

Views

Author

Reinhard Zumkeller, Mar 06 2014

Keywords

Comments

Sum of n-th row in triangle A171637.

Crossrefs

Programs

  • Haskell
    a238778 n = sum $ filter ((== 1) . a010051') $
       map (2 * n -) $ takeWhile (<= 2 * n) a000040_list
    
  • Mathematica
    Table[Total@Select[Select[Prime[Range[2 n]], # < 2 n &], PrimeQ[2 n - #] &], {n, 2, 56}] (* Robert Price, Apr 26 2025 *)
  • PARI
    a(n) = my(s=0); forprime(p=2, 2*n, if(isprime(2*n-p), s+=p)); s; \\ Michel Marcus, Jan 24 2022

Formula

a(n) = A008472(A238711(n)).
a(n) mod 2 = A010051(n).
a(n) = n*A035026(n). - Robert G. Wilson v, Apr 28 2018

A236747 Number of 0 <= k <= sqrt(n) such that n-k and n+k are both prime.

Original entry on oeis.org

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

Views

Author

Juri-Stepan Gerasimov, Jan 30 2014

Keywords

Comments

Probably a(n) > N for any N and all sufficiently large n. Perhaps a(2591107) is the last 0 in this sequence. - Charles R Greathouse IV, Jan 30 2014
Primes p such that a(p)=1: 2, 3, 7, 11, 13, 17, 19, ... . Juri-Stepan Gerasimov, Feb 02 2014

Examples

			a(3) = 1 because 3 - 0 = 3 and 3 + 0 = 3 are both prime for k = 0;
a(4) = 1 because 4 - 1 = 3 and 4 + 1 = 5 are both prime for k = 1 < sqrt(4) = 2;
a(5) = 2 because 5 - 0 = 5 and 5 + 0 = 5 are both prime for k = 0, 5 - 2 = 3 and 5 + 2 = 7 are both prime for k = 2 < sqrt(5).
		

Crossrefs

Programs

  • Maple
    A236767 := proc(n)
        local a,k ;
        a := 0 ;
        for k from 0 to floor(sqrt(n)) do
            if isprime(n-k) and isprime(n+k) then
                a := a+1 ;
            end if;
        end do:
        a ;
    end proc:
    seq(A236767(n),n=1..80) ; # R. J. Mathar, Dec 01 2020
  • Mathematica
    Table[Length[Select[Range[0, Sqrt[n]], PrimeQ[n - #] && PrimeQ[n + #] &]], {n, 100}] (* T. D. Noe, Feb 01 2014 *)
  • PARI
    a(n)=sum(k=0,sqrtint(n),isprime(n-k)&&isprime(n+k)) \\ Charles R Greathouse IV, Jan 30 2014
    
  • Scheme
    (define (A236747 n) (add (lambda (k) (* (A010051 (- n k)) (A010051 (+ n k)))) 0 (A000196 n)))
    ;; The following implements sum_{i=lowlim..uplim} intfun(i):
    (define (add intfun lowlim uplim) (let sumloop ((i lowlim) (res 0)) (cond ((> i uplim) res) (else (sumloop (1+ i) (+ res (intfun i)))))))
    ;; From Antti Karttunen, Feb 01 2014

Formula

a(n) = Sum_{k=0..A000196(n)} (A010051(n-k) * A010051(n+k)). - Antti Karttunen, Feb 01 2014

Extensions

Terms recomputed (with corrections) by Antti Karttunen, Feb 01 2014

A343564 a(n) is the sum of 2*n mod p for primes p such that 2*n-p is prime.

Original entry on oeis.org

0, 0, 0, 5, 4, 7, 5, 10, 19, 18, 11, 32, 17, 25, 45, 24, 25, 56, 10, 45, 66, 32, 39, 96, 68, 55, 99, 59, 46, 148, 29, 104, 138, 49, 103, 162, 81, 112, 164, 91, 109, 260, 64, 105, 316, 115, 104, 235, 119, 202, 294, 188, 127, 319, 224, 251, 409, 177, 162, 500, 124, 181, 504, 135, 315, 437, 187, 271
Offset: 1

Views

Author

J. M. Bergot and Robert Israel, Apr 20 2021

Keywords

Comments

Conjecture: the only n for which a(n) <= n are 1, 2, 3, 5, 7, 11, 19, and 31.

Examples

			For n=5, we have 2*n = 3+7 = 5+5, and a(5) = (10 mod 3)+(10 mod 5)+(10 mod 7) = 1+0+3 = 4.
		

Crossrefs

Programs

  • Maple
    N:= 1000: # for a(1)..a(N)
    P:= select(isprime,[seq(i,i=3..2*N)]):
    f:= proc(n) local m,Q,q;
      m:= ListTools:-BinaryPlace(P,2*n);
      Q:= convert(P[1..m],set);
      Q:= Q intersect map(t -> 2*n-t, Q);
      add(2*n mod q, q = Q);
    end proc:
    map(f, [$1..N]);
  • PARI
    a(n) = my(p=2, s=0); forprime(p=2, 2*n, if (isprime(2*n-p), s += (2*n % p))); s; \\ Michel Marcus, Apr 20 2021

A230260 Number of decompositions of 2n into unordered sums of two primes with an even sum of Hamming weights.

Original entry on oeis.org

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

Views

Author

Juri-Stepan Gerasimov, Oct 14 2013

Keywords

Comments

Number of ways to write 2*n = p + q with A000120(p) + A000120(q) = 2*k for p, q primes and some k.
A045917(n) = a(n) + (number of decompositions of 2n into unordered sums of two primes where Hamming weight of concatenation of this primes is equal to 2*m+1).
A045917(n) - a(n) = b(n): 0, 0, 0, 0, 1, 1, 1, 2, 1, 0, 1, 2, 0, 1, ... .
b(n) = 0 for n: 1, 2, 3, 4, 10, 13, 16, 19, 34, 43, 46, 49, 64, 82, 94.
Strengthening of Goldbach's conjecture: b(n) > 0 for all n > 94.
If 2*a(n) = A045917(n) then n: 1, 5, 7, 9, 14, 17, 25, 30, 33, 50, 57, 76, 77, 92, ... .
a(n) = 0 for n = 2*4^m, m>0 since 2*2*4^m in binary is 1 followed by an even number of zeros, and so 4^m-x and x (because they are binary complement of each other) together always have 2m+1 one bits, as long as x is odd. - Ralf Stephan, Oct 16 2013

Crossrefs

Programs

  • PARI
    a(n)=my(s);forprime(p=2,n, if((hammingweight(2*n-p)+hammingweight(p))%2==0 && isprime(2*n-p), s++)); s \\ Charles R Greathouse IV, Oct 14 2013

A306196 Irregular triangle read by rows where row n lists the primes 2n - k, with 1 < k < 2n-1, and if k is composite also 2n - p has to be prime for some prime divisor p of k.

Original entry on oeis.org

2, 3, 2, 3, 5, 3, 5, 7, 2, 5, 7, 2, 3, 5, 7, 11, 3, 5, 7, 11, 13, 3, 5, 7, 11, 13, 2, 3, 5, 7, 11, 13, 17, 2, 3, 5, 7, 11, 13, 17, 19, 2, 3, 5, 7, 11, 13, 17, 19, 2, 3, 5, 7, 11, 13, 17, 19, 23, 3, 5, 11, 13, 17, 23, 2, 7, 11, 13, 17, 19, 23, 2, 3, 5, 11, 13, 17, 19, 23, 29
Offset: 2

Views

Author

Juri-Stepan Gerasimov, Jan 28 2019

Keywords

Comments

Conjectures:
(i) 1 <= A035026(n) <= (n-th row length of this triangle) for n >= 2;
(ii) a(n,1) < A171637(n,1) for n >= 4.
Numbers m such that m-th row length of this triangle is equal to A000720(m): 1, 2, 11, 13, 25, 56, 60, ...

Examples

			Row 2 = [2] because 2*2 = 2 + 2;
Row 3 = [3] because 2*3 = 3 + 3;
Row 4 = [2,3,5] because 2*4 - 2 = 6 = 2*3 and 2*4 = 3 + 5;
Row 5 = [3,5,7] because 2*5 = 3 + 7 = 5 + 5.
The table starts:
  2;
  3;
  2,  3,  5;
  3,  5,  7;
  2,  5,  7;
  2,  3,  5,  7, 11;
  3,  5,  7, 11, 13;
  3,  5,  7, 11, 13;
  2,  3,  5,  7, 11, 13, 17;
  2,  3,  5,  7, 11, 13, 17, 19;
  2,  3,  5,  7, 11, 13, 17, 19;
  2,  3,  5,  7, 11, 13, 17, 19, 23;
  3,  5, 11, 13, 17, 23;
  2,  7, 11, 13, 17, 19, 23;
  2,  3,  5, 11, 13, 17, 19, 23, 29;
		

Crossrefs

Supersequence of A171637.

Programs

  • PARI
    isok(k,n) = {if (isprime(2*n-k), pf = factor(k)[,1]; for (j=1, #pf, if (isprime(2*n-pf[j]), return (1));););}
    row(n) = {my(v = []); for (k=1, 2*n, if (isok(k,n), v = concat(v, 2*n-k))); vecsort(v);} \\ Michel Marcus, Mar 02 2019
Showing 1-10 of 10 results.