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

A215029 To get a(n), start with m=n, let p = largest prime < m, set m = m-p if m>0, or m=m+p if m <= 0; repeat until p=2 has been processed; set a(n) = m.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Aug 05 2012

Keywords

Crossrefs

Programs

  • Maple
    f:=proc(n) local m,a,i,p;
    if n <= 2 then RETURN(n); fi;
    m:=n; a:=n;
    for i from 1 to n do
    p:=prevprime(m);
    if a>0 then a:=a-p else a:=a+p; fi;
    m:=p;
    if m <= 2 then RETURN(a); fi;
    od;
    # should never reach here
    print("ERROR");
    end;
    [seq(f(i),i=0..120)];
  • PARI
    A215029(n) = if(n<=2,n,my(mp=precprime(n-1),d=n); while(mp>0, if(d>0, d -= mp, d += mp); mp = precprime(mp-1)); (d)); \\ Antti Karttunen, Nov 28 2018

A214912 Primes p such that A215029(p) = 0.

Original entry on oeis.org

5, 11, 17, 23, 59, 73, 83, 97, 109, 137, 157, 167, 191, 197, 211, 227, 233, 257, 277, 307, 331, 379, 419, 439, 509, 547, 571, 599, 643, 661, 677, 691, 709, 727, 797, 823, 853, 877, 947, 977, 991, 1009, 1031, 1051, 1087, 1103, 1117, 1153, 1171, 1229, 1259, 1289, 1303, 1319, 1367, 1381, 1453, 1471, 1489, 1597, 1621, 1663, 1709, 1753, 1867, 1879, 1901, 1933
Offset: 1

Views

Author

N.Harishankar, Jul 29 2012

Keywords

Comments

If p is in this sequence then p is a linear combination of all smaller primes taken with coefficients either 1 or -1. (The converse is not true.)

Examples

			5=3+2 is a member, so is 11=7+5-3+2.
		

Crossrefs

Extensions

Edited and extended by N. J. A. Sloane, Aug 05 2012

A215030 a(n) = A215029(A000040(n)), where A000040(n) is the n-th prime.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Aug 05 2012

Keywords

Comments

For primes whose value is 0, see A214912; for value 1 see A031215; and for value 2 see A215031.

Crossrefs

Programs

  • PARI
    A215029(n) = if(n<=2,n,my(mp=precprime(n-1),d=n); while(mp>0, if(d>0, d -= mp, d += mp); mp = precprime(mp-1)); (d));
    A215030(n) = A215029(prime(n)); \\ Antti Karttunen, Nov 28 2018

A215031 Primes p such that A215029(p) = 2.

Original entry on oeis.org

2, 31, 41, 47, 67, 103, 127, 149, 179, 241, 269, 283, 313, 347, 353, 367, 389, 401, 431, 449, 461, 467, 487, 499, 523, 563, 587, 607, 617, 631, 653, 739, 751, 761, 773, 811, 829, 859, 883, 907, 919, 937, 967, 1019, 1039, 1063, 1093, 1129, 1187, 1201, 1217, 1237, 1279, 1297, 1327, 1409, 1427, 1433, 1447, 1483, 1499, 1523, 1543, 1553, 1567, 1579, 1607, 1613, 1637
Offset: 1

Views

Author

N. J. A. Sloane, Aug 05 2012

Keywords

Crossrefs

A215032 Numbers n such that A215029(n) = -1.

Original entry on oeis.org

4, 10, 16, 22, 38, 44, 54, 58, 64, 72, 82, 92, 96, 108, 116, 120, 124, 132, 136, 142, 146, 152, 156, 166, 176, 182, 186, 190, 196, 202, 206, 210, 226, 232, 252, 256, 266, 272, 276, 294, 298, 302, 306, 318, 322, 326, 330, 340, 344, 350, 360, 364, 374, 378, 386, 398, 410, 414, 418, 424, 428, 434, 438, 446, 458, 464, 480, 484, 492, 496, 504, 508, 542, 546, 560
Offset: 1

Views

Author

N. J. A. Sloane, Aug 05 2012

Keywords

Comments

All terms are composite.

Crossrefs

A215033 Numbers n such that A215029(n) = 0.

Original entry on oeis.org

0, 5, 6, 11, 12, 17, 18, 23, 24, 26, 28, 32, 34, 36, 39, 42, 45, 48, 50, 52, 55, 59, 60, 65, 68, 70, 73, 74, 76, 78, 83, 84, 86, 88, 93, 97, 98, 100, 104, 106, 109, 110, 112, 117, 121, 125, 128, 130, 133, 137, 138, 143, 147, 150, 153, 157, 158, 160, 162, 167, 168, 170, 172, 177, 180, 183, 187, 191, 192, 197, 198, 203, 207, 211, 212, 214, 216, 218, 220, 222, 227
Offset: 1

Views

Author

N. J. A. Sloane, Aug 05 2012

Keywords

Crossrefs

Cf. A215029-A215035. A214912 is a subsequence.

A215034 Numbers n such that A215029(n) = 1.

Original entry on oeis.org

1, 3, 7, 8, 13, 14, 19, 20, 25, 27, 29, 30, 33, 35, 37, 40, 43, 46, 49, 51, 53, 56, 61, 62, 66, 69, 71, 75, 77, 79, 80, 85, 87, 89, 90, 94, 99, 101, 102, 105, 107, 111, 113, 114, 118, 122, 126, 129, 131, 134, 139, 140, 144, 148, 151, 154, 159, 161, 163, 164, 169, 171, 173, 174, 178, 181, 184, 188, 193, 194, 199, 200, 204, 208, 213, 215, 217, 219, 221, 223, 224
Offset: 1

Views

Author

N. J. A. Sloane, Aug 05 2012

Keywords

Crossrefs

Cf. A215029-A215035. A031215 is a subsequence.
Showing 1-7 of 7 results.