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

A374318 For any n > 0, let b_n(n+1) = 0, and for k = 1..n, if b_n(k+1) >= k then b_n(k) = b_n(k+1) - k otherwise b_n(k) = b_n(k+1) + k; a(n) = b_n(1).

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Jul 04 2024

Keywords

Comments

This sequence is a variant of A008344; here we add or subtract by numbers from n down to 1, there by numbers from 1 up to n.
Apparently, the sequence only contains 0's, 1's and 2's.

Examples

			The first terms, alongside the corresponding sequences b_n, are:
  n   a(n)  b_n
  --  ----  ----------------------------------
   0     0  [0]
   1     1  [1, 0]
   2     1  [1, 2, 0]
   3     0  [0, 1, 3, 0]
   4     2  [2, 3, 1, 4, 0]
   5     1  [1, 2, 4, 1, 5, 0]
   6     1  [1, 0, 2, 5, 1, 6, 0]
   7     2  [2, 3, 5, 2, 6, 1, 7, 0]
   8     0  [0, 1, 3, 6, 2, 7, 1, 8, 0]
   9     1  [1, 2, 0, 3, 7, 2, 8, 1, 9, 0]
  10     1  [1, 2, 4, 7, 3, 8, 2, 9, 1, 10, 0]
		

Crossrefs

Programs

  • PARI
    a(n) = { my (b = 0); forstep (k = n, 1, -1, if (b >= k, b -= k, b += k);); return (b); }

Formula

Empirically, a(n) = 1 iff n belongs to A042963.
Showing 1-1 of 1 results.