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.

A330402 Lexicographically earliest sequence of distinct positive terms with an associate sequence t such that t(0) = 0, and for any n > 0, at least one of t(n-1) - a(n) or t(n-1) + a(n) is a prime number; in case t(n-1) - a(n) is a prime number, set t(n) = t(n-1) - a(n), otherwise set t(n) = t(n-1) + a(n).

Original entry on oeis.org

2, 1, 4, 5, 3, 6, 8, 10, 11, 9, 12, 14, 16, 18, 24, 20, 22, 28, 30, 26, 32, 34, 38, 36, 42, 40, 46, 44, 50, 45, 15, 54, 48, 21, 17, 52, 56, 60, 62, 66, 58, 70, 64, 78, 68, 27, 29, 72, 74, 80, 82, 84, 76, 96, 86, 39, 35, 90, 98, 102, 88, 41, 51, 104, 94, 100
Offset: 1

Views

Author

Rémy Sigrist, Dec 13 2019

Keywords

Comments

This sequence is a variant of A330401.

Examples

			The first terms, alongside t(n), are:
  n   a(n)  t(n)
  --  ----  ----
   0  N/A      0
   1     2     2
   2     1     3
   3     4     7
   4     5     2
   5     3     5
   6     6    11
   7     8     3
   8    10    13
   9    11     2
  10     9    11
  11    12    23
  12    14    37
		

Crossrefs

Cf. A330401, A330421 (running totals).

Programs

  • PARI
    See Links section.