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.

A254337 Lexicographically earliest sequence of distinct numbers such that no sum of consecutive terms is prime.

Original entry on oeis.org

0, 1, 8, 6, 10, 14, 12, 4, 20, 16, 24, 18, 22, 28, 26, 34, 30, 32, 36, 40, 42, 46, 38, 44, 52, 48, 54, 50, 58, 56, 62, 64, 60, 66, 68, 72, 70, 74, 80, 76, 78, 86, 82, 84, 90, 92, 94, 88, 98, 96, 104, 100, 102, 108, 110, 112, 114, 106, 116, 122, 118, 120, 124, 126, 130, 132, 134, 128, 138, 136, 142, 140, 144, 146, 148, 150, 154, 152, 156, 158
Offset: 0

Views

Author

M. F. Hasler, Jan 28 2015

Keywords

Comments

In other words, no sum a(i)+a(i+1)+a(i+2)+...+a(n) may be prime. In particular, the sequence may not contain any primes.
I conjecture that the sequence contains all even numbers > 2 and no odd number beyond 1. If so, we must simply ensure that the sum a(1)+...+a(n) is not prime, which is always possible for one of the three consecutive even numbers {2n, 2n+2, 2n+4}. As a consequence, it would follow that a(n) ~ 2n.
Is there even a proof that the smallest odd composite number, 9, does not appear?
The variant A254341 has the additional restriction of alternating parity, which avoids excluding the odd numbers.
The least odd composite number a'(n+1) that could occur as the next term after a(n) and such that sum(a(i),i=k...n)+a'(n+1) is composite for all k <= n is (for n = 0, 1, 2,...): 9, 9, 25, 21, 39, 25, 69, 65, 45, 119, 95, 77, 55, 27, 595, 561, 531, 865, 1519, 1479, 1437, 1391, 1353, 1309, 1257, 1209, 1155, 1105, 1047, 2317, 2255, 2191, 3565, 5719, 13067, 12995, 12925, 12851, 12771, 12695, 12617, 12531, 12449, 12365, 12275, ... The growth of this sequence shows how it is increasingly unlikely that an odd number could occur, since the next possible even term is only about 2n.

Examples

			To explain the beginning of the sequence, observe that starting with the smallest possible terms 0, 1 does not appear to lead to a contradiction (and in fact never does), so we start there.
The next composite would be 4 but 1+4=5 is prime, as is 1+6, but 1+8=9 is not, so we take a(2) = 8 to be the next term.
4 is impossible for a(3) since 1+8+4=13 is prime, but neither 1+8+6=15 nor 8+6 is prime, so a(3)=6.
		

Crossrefs

Cf. A025044 (no pairwise sum is prime), A025043 (no pairwise difference is prime).

Programs

  • Mathematica
    f[lst_List] := Block[{k = 1}, While[ PrimeQ@ k || MemberQ[lst, k] || Union@ PrimeQ@ Accumulate@ Reverse@ Join[lst, {k}] != {False}, k++]; Append[lst, k]]; Nest[f, {0}, 70] (* Robert G. Wilson v, Jan 31 2015 *)
  • PARI
    a=[];u=0; for(i=1,99, a=concat(a,0); until( ! isprime(s) || ! a[i]++, while( isprime(a[i]) || bittest(u,a[i]), a[i]++); s=a[k=i]; while( k>1 && ! isprime( s+=a[k--]),)); u+=2^a[i]; print1(a[i]","))

Formula

It appears that a(n) ~ 2n.

A025044 a(n) not of form prime - a(k), k < n.

Original entry on oeis.org

0, 1, 8, 14, 20, 24, 25, 26, 32, 38, 44, 50, 56, 62, 68, 74, 80, 86, 90, 92, 94, 98, 104, 110, 116, 118, 120, 122, 128, 134, 140, 144, 146, 152, 158, 160, 164, 170, 176, 182, 184, 188, 194, 200, 206, 212, 218, 220, 224, 230, 234, 236, 242, 248, 254, 260, 264, 266, 272, 274
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Mathematica
    a1 = {0}; nmax = 275; Do[ If[Select[n + a1, PrimeQ] == {}, AppendTo[a1, n]] , {n, nmax}]; a1 (* Ray Chandler, Jan 15 2017 *)

A014589 Nim function for Take-a-Prime (or Subtract-a-Prime) Game.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

The zero positions are given by A025043. - Nathan Fox, May 21 2013
Concerning the January 1997 dissertation of Achim Flammenkamp, his home page (currently http://wwwhomes.uni-bielefeld.de/cgi-bin/cgiwrap/achim/index.cgi) has the link shown below, and a comment that a book was published in July 1997 by Hans-Jacobs-Verlag, Lage, Germany with the title Lange Perioden in Subtraktions-Spielen (ISBN 3-932136-10-1). This is an enlarged study (more than 200 pages) of his dissertation. - N. J. A. Sloane, Jul 25 2019
As noted by Alexis Huet, a(n) <= 11 for all n <= 32452842 (see links). - Pontus von Brömssen, Jul 09 2022
From Bert Dobbelaere, Apr 09 2024: (Start)
For n <= 10^9, a(n) <= 11.
For even n <= 10^9, if a(n)=0, n is in {0, 10, 34, 100, 310}.
For even n <= 10^9, if a(n)=1, n is in {2, 12, 36, 102, 312}.
For even n <= 10^9, if a(n)=2, n is in {4, 14, 38, 104, 314, 1574}.
For even n <= 10^9, if a(n)=3, n is in {6, 16, 40, 106, 316, 1576, 1996, 5566}.
The only odd n <= 10^9 for which a(n)=4 is 17.
The only odd n <= 10^9 for which a(n)=5 is 19.
The only odd n <= 10^9 for which a(n)=6 is 21.
The only even n <= 10^9 for which a(n)=7 is 24.
There are no even n <= 10^9 for which a(n)=8 or a(n)=10.
There are no odd n <= 10^9 for which a(n)=11. (End)

References

  • R. K. Guy, Unsolved Problems in Number Theory, E26.

Crossrefs

Programs

  • Sage
    def A014589_list(max) :
        res = []
        for i in range(max+1) :
            moves = list({res[i-p] for p in prime_range(i+1)})
            moves.sort()
            k = len(moves)
            mex = next((j for j in range(k) if moves[j] != j), k)
            res.append(mex)
        return res
    print(A014589_list(50))
    # Eric M. Schmidt, Jul 20 2013, corrected Eric M. Schmidt, Apr 24 2019

A227691 Winning positions in the Subtract-a-Prime game.

Original entry on oeis.org

2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 28, 29, 30, 31, 32, 33, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 50, 51, 52, 53, 54, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74
Offset: 1

Views

Author

Keywords

Comments

Consider the following game: two players make moves in turn, initially the number on the board is n. Each move consists of subtracting a prime number that is at most the number on the board. The player who cannot play loses. This sequence is the set of winner positions in this game.
Complement of A025043.

Crossrefs

The Grundy numbers of this game are in A014589.

Programs

  • Mathematica
    moves[n_] := Table[n - Prime[i], {i, 1, PrimePi[n]}]
    gana[n_] := gana[n] = If[n < 2, False,! Select[moves[n],!gana[#] &] == {}];
    Select[Range[155], gana[#] &]
  • PARI
    is(n)=if(isprime(n) || isprime(n-1), return(1)); if(n<15,return(0)); for(k=9,n-1,if(isprime(n-k) && !is(k), return(1))); 0 \\ Charles R Greathouse IV, Nov 13 2013

A072545 a(0) = 1, a(n) for n > 0 is the smallest number > a(n-1) such that a(n)-a(k) is nonprime for 0 <= k < n.

Original entry on oeis.org

1, 2, 10, 11, 26, 35, 36, 50, 56, 86, 92, 101, 116, 122, 126, 134, 146, 156, 170, 176, 188, 196, 206, 218, 236, 248, 254, 260, 266, 290, 296, 302, 310, 311, 320, 326, 336, 344, 356, 362, 376, 386, 392, 396, 404, 416, 426, 446, 452, 470, 476, 482, 486, 494
Offset: 0

Views

Author

Amarnath Murthy, Aug 04 2002

Keywords

Comments

a(0) = 1, a(3) = 11, a(5) = 35, a(11) = 101 and a(33) = 311 are the only odd elements <= 10^6 and probably the only ones. If so, then for n >= 34, a(n) is the smallest even k >= a(n-1)+4 for which none of k-1, k-11, k-35, k-101 or k-311 is prime. - David W. Wilson, Dec 14 2006

Examples

			26 is the smallest number > 11 which differs from 1, 2, 10, 11 by a nonprime (25, 24, 16, 15), so 26 is the next term after 11.
		

Crossrefs

Programs

  • PARI
    print1(a=1,","); v=[1]; n=1; while(n<55,a++; k=1; while(k<=n&&!isprime(a-v[k]), k++); if(k>n,n++; v=concat(v,a); print1(a,",")))

Extensions

Edited and extended by Klaus Brockhaus, Aug 09 2002

A227763 Winning positions in the misere version of the Subtract-a-Prime game.

Original entry on oeis.org

1, 4, 5, 6, 7, 8, 9, 10, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 28, 29, 30, 31, 32, 33, 34, 35, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 52, 53, 54, 55, 56, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75
Offset: 1

Views

Author

Keywords

Comments

Consider the following game: two players make moves in turn, initially the number on the board is n. Each move consists of subtracting a prime number that is at most the number on the board. The player who cannot play wins. This sequence is the set of winning positions in this game.

Crossrefs

Programs

  • Mathematica
    moves[n_]:= Table[n - Prime[i], {i, 1, PrimePi[n]}]; gana[n_]:= gana[n] = If[n < 2, True, !Select[moves[n], !gana[#]&]=={}]; Select[Range[155], gana[#] &]

A227764 Losing positions in the misere version of the Subtract-a-Prime game.

Original entry on oeis.org

2, 3, 11, 12, 27, 36, 37, 51, 57, 87, 93, 102, 117, 123, 127, 135, 147, 157, 171, 177, 189, 197, 207, 219, 237, 249, 255, 261, 267, 291, 297, 303, 311, 312, 321, 327, 337, 345, 357, 363, 377, 387, 393, 397, 405, 417, 427, 447, 453, 471, 477, 483, 487, 495
Offset: 1

Views

Author

Keywords

Comments

Consider the following game: two players make moves in turn; initially the number on the board is n. Each move consists of subtracting a prime number that is at most the number on the board. The player who cannot play wins. This sequence is the set of lost positions in this game.

Crossrefs

Programs

  • Mathematica
    moves[n_] := Table[n - Prime[i], {i, 1, PrimePi[n]}]; gana[n_] := gana[n] = If[n < 2, True, ! Select[moves[n], !gana[#] &] == {}]; Select[Range[155], !gana[#] &]
Showing 1-7 of 7 results.