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

A338241 For any m >= 0, a(3*m) = 3*a(m), a(3*m+1) = 1-3*a(m), a(3*m+2) = 3*a(m)-1.

Original entry on oeis.org

0, 1, -1, 3, -2, 2, -3, 4, -4, 9, -8, 8, -6, 7, -7, 6, -5, 5, -9, 10, -10, 12, -11, 11, -12, 13, -13, 27, -26, 26, -24, 25, -25, 24, -23, 23, -18, 19, -19, 21, -20, 20, -21, 22, -22, 18, -17, 17, -15, 16, -16, 15, -14, 14, -27, 28, -28, 30, -29, 29, -30, 31
Offset: 0

Views

Author

Rémy Sigrist, Oct 18 2020

Keywords

Comments

This sequence is a variant of A117966.
This sequence is a bijection from N = [0..+oo) to Z = (-oo..+oo).

Examples

			For n = 0:
- a(3*0) = 3*a(0),
- so a(0) = 0.
For n = 1:
- a(1) = 1 - 3*a(0) = 1.
For n = 2:
- a(2) = 3*a(0) - 1 = -1.
For n = 4:
- a(4) = 1 - 3*a(1) = -2.
		

Crossrefs

Cf. A005823, A117966, A338242-A338243 (bisections).

Programs

  • PARI
    a(n) = { if (n==0, return (0), my (d=n%3, m=n\3); if (d==0, 3*a(m), d==1, 1-3*a(m), 3*a(m)-1)) }

Formula

Sum_{k = 0..n} a(k) >= 0 with equality iff n belongs to A005823.

A338242 a(n) = -A338241(2*n) for any n >= 0.

Original entry on oeis.org

0, 1, 2, 3, 4, 8, 6, 7, 5, 9, 10, 11, 12, 13, 26, 24, 25, 23, 18, 19, 20, 21, 22, 17, 15, 16, 14, 27, 28, 29, 30, 31, 35, 33, 34, 32, 36, 37, 38, 39, 40, 80, 78, 79, 77, 72, 73, 74, 75, 76, 71, 69, 70, 68, 54, 55, 56, 57, 58, 62, 60, 61, 59, 63, 64, 65, 66, 67
Offset: 0

Views

Author

Rémy Sigrist, Oct 18 2020

Keywords

Comments

This sequence is a self-inverse permutation of the nonnegative integers.

Examples

			a(7) = -A338241(14) = 7.
		

Crossrefs

Programs

  • PARI
    b(n) = { if (n==0, return (0), my (d=n%3, m=n\3); if (d==0, 3*b(m), d==1, 1-3*b(m), 3*b(m)-1)) }
    a(n) = -b(2*n)
Showing 1-2 of 2 results.