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

A103506 Smallest prime p such that 2n+1 = 2q + p for some odd prime q, or 0 if no such prime exists.

Original entry on oeis.org

0, 0, 0, 3, 5, 3, 5, 3, 5, 7, 13, 3, 5, 3, 5, 7, 13, 3, 5, 3, 5, 7, 13, 3, 5, 7, 17, 11, 13, 3, 5, 3, 5, 7, 13, 11, 13, 3, 5, 7, 37, 3, 5, 3, 5, 7, 13, 3, 5, 7, 17, 11, 13, 3, 5, 7, 29, 11, 13, 3, 5, 3, 5, 7, 13, 11, 13, 3, 5, 7, 37, 3, 5, 3, 5, 7, 13, 11
Offset: 1

Views

Author

Lei Zhou, Feb 09 2005

Keywords

Examples

			For n < 4 there are no such primes, thus a(1)-a(3)=0.
For n=4, 2*4+1 = 9 = 2*3+3, thus a(4)=3.
For n=11, 2*11+1 = 23 = 2*5+13, thus a(11)=13.
		

Crossrefs

a(n)=0 if A103509(n)=0, otherwise A000040(A103509(n)).

Programs

  • Mathematica
    Join[{0,0,0}, Table[m=3; While[! (PrimeQ[m] && (((n-m)/2) > 2) && PrimeQ[(n-m)/2]), m=m+2]; m, {n, 9, 299, 2}]]
  • Scheme
    (define (A103506 n) (let ((ind (A103509 n))) (if (zero? ind) 0 (A000040 ind)))) ;; Antti Karttunen, Jun 19 2007

Extensions

Edited by Antti Karttunen, Jun 19 2007

A103153 a(n) is the smallest odd prime p such that 2*n+1 = 2*p + A000040(k) for some k>1, or 0 if no such prime exists.

Original entry on oeis.org

0, 0, 0, 3, 3, 3, 5, 3, 3, 5, 3, 3, 5, 3, 7, 5, 3, 3, 5, 5, 3, 7, 3, 3, 5, 3, 7, 5, 3, 7, 5, 3, 3, 5, 5, 3, 7, 3, 3, 5, 5, 3, 7, 3, 19, 5, 3, 7, 5, 11, 3, 11, 3, 3, 5, 3, 3, 5, 3, 7, 5, 11, 7, 11, 11, 3, 11, 3, 13, 5, 3, 3, 5, 5, 7, 7, 3, 3, 5, 5, 3, 7, 5, 3, 7, 3, 13, 5, 3, 7, 5, 3, 3, 5, 5, 7, 7, 3
Offset: 1

Views

Author

Lei Zhou, Feb 09 2005

Keywords

Examples

			For n < 4 there are no such primes, thus a(1)-a(3)=0. For n=4, 2*4+1 = 9 = 2*3+3, thus a(4)=3. For n=7, 2*7+1 = 15 = 2*5+5, thus a(7)=7.
		

Crossrefs

a(n)=0 if A103507(n)=0, otherwise A000040(A103507(n)).
Cf. A195352 (similar definition, but p=2 is allowed).

Programs

  • Mathematica
    Do[m = 3; While[ ! (PrimeQ[m] && ((n - 2*m) > 2) && PrimeQ[n - 2*m]), m = m + 2]; Print[m], {n, 9, 299, 2}]
  • Scheme
    (define (A103153 n) (let ((ind (A103507 n))) (if (zero? ind) 0 (A000040 ind))))

Extensions

Edited and Scheme code added by Antti Karttunen, Jun 19 2007
Definition corrected by Hugo Pfoertner, Sep 16 2011

A103152 Smallest odd number which can be written as a sum 2p+q (where p and q are both odd primes, A065091) in exactly n ways, zero if there are no such odd number.

Original entry on oeis.org

9, 13, 17, 29, 45, 51, 69, 81, 99, 93, 105, 135, 153, 201, 195, 165, 231, 237, 321, 297, 225, 363, 725, 393, 285, 315, 471, 483, 435, 405, 465, 561, 555, 495, 609, 783, 675, 867, 849, 963, 645, 525, 693, 897, 795, 915, 987, 735, 855, 825, 765, 1095, 975, 1467
Offset: 1

Views

Author

Lei Zhou, Feb 09 2005

Keywords

Comments

Conjecture: except for the 2nd, 3rd and 4th terms, all other terms are divisible by 3; See also comments in A103151.
a(23)=725 is also not divisible by 3. [D. S. McNeil, Sep 06 2010]
The only terms a(n) not divisible by 3 for n <= 1450 are a(2),a(3),a(4) and a(23). - Robert Israel, Mar 17 2020

Examples

			9 is the smallest odd number with just one such composition: 9 = 3+2*3, thus a(1)=9.
Similarly, 13 is smallest with exactly 2 compositions: 13 = 3+2*5 = 7+2*3, thus a(2)=13.
		

Crossrefs

Programs

  • Maple
    N:= 2000: # for terms before the first term > N
    P:= select(isprime, [seq(i,i=3..N,2)]):
    nP:= nops(P):
    V:= Vector(N):
    for i from 1 while 2*P[i] N then break fi;
        V[k]:= V[k]+1;
    od od:
    A:= Vector(N):
    for i from 1 to N by 2 do if V[i] <> 0 and A[V[i]] = 0 then A[V[i]]:= i fi od:
    for i from 1 to N do if A[i] = 0 then break fi od:
    seq(A[j],j=1..i-1); # Robert Israel, Mar 17 2020
  • Mathematica
    Array[a, 300]; Do[a[n] = 0, {n, 1, 300}]; n = 9; ct = 0; While[ct < 200, m = 3; ct = 0; While[(m*2) < n, If[PrimeQ[m], cp = n - (2* m); If[PrimeQ[cp], ct = ct + 1]]; m = m + 2]; If[a[ct] == 0, a[ct] = n]; n = n + 2]; Print[a]
  • Scheme
    (define (A103152 n) (+ 1 (* 2 (first-n-where-fun_n-is-i1 A103151 n))))
    (define (first-n-where-fun_n-is-i1 fun i) (let loop ((n 1)) (cond ((= i (fun n)) n) (else (loop (+ n 1)))))) ;; Antti Karttunen, Jun 19 2007

Extensions

Starting offset changed from 0 to 1 by Antti Karttunen, Jun 19 2007

A103508 a(n) = 1 + 2 * least i such that A103507(i)=n+1, 0 if no such i exists.

Original entry on oeis.org

9, 15, 31, 101, 139, 227, 91, 503, 995, 451, 751, 539, 1819, 1397, 2957, 3461, 1831, 1417, 6023, 3769, 1777, 9587, 5411, 9421, 18653, 8089, 4511, 6541, 10529, 16051, 19049, 13163, 3139, 22937, 23929, 43363, 24919, 43571, 97367, 55571, 14419, 75209
Offset: 1

Views

Author

Lei Zhou, Feb 10 2005

Keywords

Crossrefs

Programs

  • Scheme
    (define (A103508 n) (+ 1 (* 2 (first-n-where-fun_n-is-i1 A103507 (+ 1 n)))))
    (define (first-n-where-fun_n-is-i1 fun i) (let loop ((n 1)) (cond ((= i (fun n)) n) (else (loop (+ n 1))))))

Extensions

Edited and Scheme-code added by Antti Karttunen, Jun 19 2007

A103510 a(n) = 1 + 2 * least i such that A103509(i)=n+1, 0 if no such i exists.

Original entry on oeis.org

9, 11, 21, 57, 23, 55, 245, 241, 115, 833, 83, 523, 437, 193, 447, 733, 167, 689, 1417, 611, 2297, 1081, 2731, 1283, 2755, 5057, 2761, 887, 2719, 9221, 4909, 8179, 4397, 13891, 9557, 2351, 9257, 5869, 10627, 11941, 1487, 2797, 3947, 5899, 11237, 20069
Offset: 1

Views

Author

Lei Zhou, Feb 10 2005

Keywords

Crossrefs

Programs

  • Mathematica
    Array[a, 500]; Do[a[n] = 0, {n, 1, 500}]; n = 9; ct = 0; While[ct < 150, m = 3; While[ ! (PrimeQ[m] && (((n - m)/2) > 2) && PrimeQ[(n - m)/2]), m = m + 2]; k = PrimePi[m]; If[a[k] == 0, a[k] = n; ct = ct + 1]; n = n + 2]; Print[a]
  • Scheme
    (define (A103510 n) (+ 1 (* 2 (first-n-where-fun_n-is-i1 A103509 (+ 1 n)))))
    (define (first-n-where-fun_n-is-i1 fun i) (let loop ((n 1)) (cond ((= i (fun n)) n) (else (loop (+ n 1))))))

Extensions

Edited and Scheme-code added by Antti Karttunen, Jun 19 2007

A276520 a(n) is the number of decompositions of n into unordered form p + c*q, where p, q are terms of A274987, c=1 for even n-s and c=2 for odd n-s.

Original entry on oeis.org

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

Views

Author

Lei Zhou, Nov 11 2016

Keywords

Comments

p=q is allowed.
It is conjectured that the primes p, q in A274987 (a subset of all primes) are sufficient to decomposite all numbers into p and c*q (c=1 when n is even, 2 when c is odd) when n > 2551.
This sequence provides a very tight alternative of the Goldbach conjecture for all positive integers, in which indices of zero terms form a complete sequence {1, 2, 3, 4, 5, 7, 32, 52, 55, 61, 128, 194, 214, 244, 292, 334, 388, 782, 902, 992, 1414, 1571, 1712, 1916, 2551}.
There are no more zero terms of a(n) up to n = 100000.

Examples

			A274987 = {3, 5, 7, 11, 13, 17, 23, 31, 37, 53, 59, 61, 73, 79, 83, 89, 101, 103, 109, ...}
For n=6, 6 = 3+3, one case of decomposition, so a(6)=1;
For n=7, 7 < 3+2*3=9, no eligible case could be found, so a(7)=0;
...
For n=17, 17 = 3+2*7 = 7+2*5 = 11+2*3, three cases of decompositions, so a(17)=3.
		

Crossrefs

Programs

  • Mathematica
    p = 3; sp = {p}; Table[l = Length[sp]; While[sp[[l]] < n, While[p = NextPrime[p]; cp = 2*3^(Floor[Log[3, 2*p - 1]]) - p; ! PrimeQ[cp]]; AppendTo[sp, p]; l++]; c = 2 - Mod[n + 1, 2]; ct = 0; Do[If[MemberQ[sp, n - c*sp[[i]]], If[c == 1, If[(2*sp[[i]]) <= n, ct++], ct++]], {i, 1, l}]; ct, {n, 1, 87}]

A147568 a(n) = 2*A000695(n)+3.

Original entry on oeis.org

3, 5, 11, 13, 35, 37, 43, 45, 131, 133, 139, 141, 163, 165, 171, 173, 515, 517, 523, 525, 547, 549, 555, 557, 643, 645, 651, 653, 675, 677, 683, 685, 2051, 2053, 2059, 2061, 2083, 2085, 2091, 2093, 2179, 2181, 2187, 2189, 2211, 2213, 2219, 2221, 2563, 2565, 2571
Offset: 0

Views

Author

Vladimir Shevelev, Nov 07 2008

Keywords

Comments

Every odd number m>=9 is a unique sum of the form a(k)+2a(l); moreover this sequence is the unique one with such property. In connection with A103151, note that there is no subsequence T of primes such that every odd number m>=9 is expressible as a unique sum of the form m=p+2q, where p and q are in T. One can prove that if one replaces 9 by any integer x_o>9, the statement remains true (see the Shevelev link).

Crossrefs

Programs

  • Mathematica
    (* b = A000695 *) b[n_] := If[n==0, 0, If[EvenQ[n], 4 b[n/2] , b[n-1]+1]];
    a[n_] := 2 b[n] + 3; Table[a[n], {n, 0, 50}] (* Jean-François Alcover, Dec 14 2018 *)
  • PARI
    a000695(n) = fromdigits(binary(n), 4);
    a(n) = 2*a000695(n)+3; \\ Michel Marcus, Dec 13 2018

Extensions

More terms from Michel Marcus, Dec 13 2018

A238268 The number of unordered ways that n can be written as the sum of two numbers of the form p or 2p, where p is prime.

Original entry on oeis.org

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

Views

Author

Lei Zhou, Feb 21 2014

Keywords

Comments

p and 2p are terms of A001751.
Sequence defined for n >= 4.
It is conjectured that all terms of this sequence are greater than zero.

Examples

			n=4, 4=2+2, one case found. So a(4)=1;
...
n=24, 24 = 2+2*11 = 5+19 = 7+17 = 2*5+2*7 = 11+13, 5 cases found.  So a(24)=5;
...
n=33, 33 = 2+31 = 2*2+29 = 7+2*13 = 2*5+23 = 11+2*11 = 2*7+19, 6 cases found.  So a(33)=6.
		

Crossrefs

Programs

  • Mathematica
    Table[ct = 0; Do[If[((PrimeQ[i]) || (PrimeQ[i/2])) && ((PrimeQ[n - i]) || (PrimeQ[(n - i)/2])), ct++], {i, 2, Floor[n/2]}]; ct, {n, 4, 89}]
  • PARI
    isp(i) = isprime(i) || (((i % 2) == 0) && isprime(i/2));
    a(n) = sum(i=1, n\2, isp(i) && isp(n-i)); \\ Michel Marcus, Mar 07 2014

A152460 Primes p such that there exist positive integer k and prime q with p > q and 3^k = p + 2q or 3^k = q + 2p.

Original entry on oeis.org

3, 5, 11, 13, 17, 23, 29, 31, 37, 43, 47, 59, 67, 71, 97, 101, 103, 107, 109, 113, 137, 149, 157, 181, 197, 229, 233, 239, 251, 263, 269, 271, 281, 283, 307, 311, 313, 331, 347, 349, 353, 359, 367, 383, 431, 467, 503, 523, 563, 571, 587, 607, 643, 647, 683, 691
Offset: 1

Views

Author

Vladimir Shevelev, Dec 05 2008, Dec 12 2008

Keywords

Comments

a(n) is the greater of primes (p,q) in representations of a power of 3 in Lemoine-Levy's form p+2q (see A046927)
If 3^n=p+2q, then 3^(n-1)<=max(p,q)<3^n. Therefore the sets of greater primes for different powers of 3 do not intersect.

Examples

			27=5+2*11=13+2*7=17+2*5=23+2*2, so that 11,13,17 and 23 are in the sequence.
		

Crossrefs

Programs

  • PARI
    aa(n)={my(v=[]); forprime(p=2,n\2,q=n-p*2; if(isprime(q),v=concat(v,(max(p,q))))); vecsort(v,,8)};
    for(n=2, 7, v=aa(3^n); for(i=1,#v,print1(v[i], ", ")))

Formula

If A(x) is the counting function of a(n)<=x, then A(x)=O(xloglogx/(logx)^2).

Extensions

Program and editing by Charles R Greathouse IV, Nov 02 2009

A238269 Smallest number that can be written in n ways as the sum of two numbers of the form p or 2p, where p is prime.

Original entry on oeis.org

4, 6, 8, 16, 24, 33, 36, 63, 48, 60, 93, 140, 84, 108, 132, 189, 165, 144, 120, 210, 297, 168, 204, 180, 276, 252, 285, 288, 462, 240, 372, 432, 336, 300, 396, 609, 360, 492, 552, 468, 564, 528, 576, 504, 708, 1089, 648, 480, 420, 540, 768, 672, 600, 816, 792
Offset: 1

Views

Author

Lei Zhou, Feb 21 2014

Keywords

Examples

			4 is the smallest number that can be written in only one way as the sum of two primes or doubled primes, 4=2+2. So a(1)=4;
6 = 2+2*2 = 3+3, two ways, so a(2)=6;
...
33 = 2+31 = 2*2+29 = 7+2*13 = 2*5+23 = 11+2*11 = 2*7+19, 6 ways.  And all numbers smaller than 33 can only be split in 5 or fewer ways.  So a(6)=33.
		

Crossrefs

Programs

  • Mathematica
    target = 55; n = 3; a = {}; sc = 0; Do[AppendTo[a, 0], {i, 1, target}]; While[sc < target, n++; ct = 0; Do[If[((PrimeQ[i]) || (PrimeQ[i/2])) && ((PrimeQ[n - i]) || (PrimeQ[(n - i)/2])), ct++], {i, 2, Floor[n/2]}]; If[ct<=target,If[a[[ct]] == 0, a[[ct]] = n; sc++]]];a
Showing 1-10 of 11 results. Next