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.

A379175 Irregular triangle T(n, k), n >= 0, k = 1..ceiling(2^(A007895(n)-1)); the n-th row lists the nonnegative integers m such that A184617(m) = A003714(n).

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Dec 17 2024

Keywords

Comments

Also the nonnegative terms of A379147, in order of appearance.
This sequence is a permutation of the nonnegative integers with inverse A379176.
This sequence shares graphical features with A368225.

Examples

			Triangle T(n, k) begins:
  n   n-th row
  --  --------------
   0  0
   1  1
   2  2
   3  4
   4  3, 5
   5  8
   6  7, 9
   7  6, 10
   8  16
   9  15, 17
  10  14, 18
  11  12, 20
  12  11, 13, 19, 21
  13  32
  14  31, 33
  15  30, 34
		

Crossrefs

Programs

  • PARI
    tozeck(n) = { for (i=0, oo, if (n<=fibonacci(2+i), my (v=0, f); forstep (j=i, 0, -1, if (n>=f=fibonacci(2+j), n-=f; v+=2^j;); if (n==0, return (v););););); }
    row(n) = { my (z = tozeck(n), r = [0], b); while (z, z -= b = 2^valuation(z, 2); r = concat([v - b | v <- r], [v + b | v <- r]);); return (select(v -> v >= 0, r)); }

Formula

T(n, ceiling(2^(A007895(n)-1))) = A003714(n).

A379147 Irregular triangle T(n, k), n >= 0, k = 1..2^A007895(n), read by rows; the n-th row lists the integers m such that A184617(abs(m)) = A003714(n).

Original entry on oeis.org

0, -1, 1, -2, 2, -4, 4, -5, -3, 3, 5, -8, 8, -9, -7, 7, 9, -10, -6, 6, 10, -16, 16, -17, -15, 15, 17, -18, -14, 14, 18, -20, -12, 12, 20, -21, -19, -13, -11, 11, 13, 19, 21, -32, 32, -33, -31, 31, 33, -34, -30, 30, 34, -36, -28, 28, 36
Offset: 0

Views

Author

Rémy Sigrist, Dec 16 2024

Keywords

Comments

A permutation of the integers (Z).
For any n >= 0:
- in the Zeckendorf expansion of n,
- replace each Fibonacci number, say A000045(2+i) with i >= 0, by 2^i or -2^i,
- the various values obtained make up the n-th row.

Examples

			Triangle T(n, k) begins:
  n   n-th row
  --  ----------------------------------
   0  0
   1  -1, 1
   2  -2, 2
   3  -4, 4
   4  -5, -3, 3, 5
   5  -8, 8
   6  -9, -7, 7, 9
   7  -10, -6, 6, 10
   8  -16, 16
   9  -17, -15, 15, 17
  10  -18, -14, 14, 18
  11  -20, -12, 12, 20
  12  -21, -19, -13, -11, 11, 13, 19, 21
  13  -32, 32
  14  -33, -31, 31, 33
  15  -34, -30, 30, 34
		

Crossrefs

Programs

  • PARI
    tozeck(n) = { for (i=0, oo, if (n<=fibonacci(2+i), my (v=0, f); forstep (j=i, 0, -1, if (n>=f=fibonacci(2+j), n-=f; v+=2^j;); if (n==0, return (v););););); }
    row(n) = { my (z = tozeck(n), r = [0], b); while (z, z -= b = 2^valuation(z, 2); r = concat([v - b | v <- r], [v + b | v <- r]);); return (r); }

Formula

T(n, 1) = -A003714(n).
T(n, 2^A007895(n)) = A003714(n).
T(n, k) = -T(n, 2^A007895(n)+1-k) for k = 1..2^A007895(n).

A178729 a(n) = n XOR 3n, where XOR is bitwise XOR.

Original entry on oeis.org

0, 2, 4, 10, 8, 10, 20, 18, 16, 18, 20, 42, 40, 42, 36, 34, 32, 34, 36, 42, 40, 42, 84, 82, 80, 82, 84, 74, 72, 74, 68, 66, 64, 66, 68, 74, 72, 74, 84, 82, 80, 82, 84, 170, 168, 170, 164, 162, 160, 162, 164, 170, 168, 170, 148, 146, 144, 146, 148, 138, 136, 138, 132, 130
Offset: 0

Views

Author

Dmitry Kamenetsky, Jun 08 2010

Keywords

Crossrefs

Programs

Formula

a(n) = A005351(n) XOR A005352(n) (conjectured). Proved by Verrill link.
a(n) = 2 * A184617(n). - Alois P. Heinz, Jul 21 2017

Extensions

a(30) onwards from Robert G. Wilson v, Jun 09 2010

A184615 Positive parts of the nonadjacent forms for n.

Original entry on oeis.org

0, 1, 2, 4, 4, 5, 8, 8, 8, 9, 10, 16, 16, 17, 16, 16, 16, 17, 18, 20, 20, 21, 32, 32, 32, 33, 34, 32, 32, 33, 32, 32, 32, 33, 34, 36, 36, 37, 40, 40, 40, 41, 42, 64, 64, 65, 64, 64, 64, 65, 66, 68, 68, 69, 64, 64, 64, 65, 66, 64, 64, 65, 64, 64, 64, 65, 66, 68, 68, 69, 72, 72, 72, 73, 74, 80, 80, 81, 80, 80, 80, 81, 82, 84, 84, 85, 128
Offset: 0

Views

Author

Joerg Arndt, Jan 18 2011

Keywords

Comments

This sequence together with A184616 (negated negative parts) gives the (signed binary) nonadjacent form (NAF) of n, see fxtbook link.
No two adjacent bits in the binary representations of a(n) are 1.
No two adjacent bits in the binary representations of a(n)+A184616(n) are 1.

Examples

			The first few nonadjacent forms (NAF) are
(dots are used for zeros for better readability):
     n     binary(n)  NAF(n)
   0:    .......    .......      0 =
   1:    ......1    ......P      1 =  +1
   2:    .....1.    .....P.      2 =  +2
   3:    .....11    ....P.M      3 =  +4 -1
   4:    ....1..    ....P..      4 =  +4
   5:    ....1.1    ....P.P      5 =  +4 +1
   6:    ....11.    ...P.M.      6 =  +8 -2
   7:    ....111    ...P..M      7 =  +8 -1
   8:    ...1...    ...P...      8 =  +8
   9:    ...1..1    ...P..P      9 =  +8 +1
  10:    ...1.1.    ...P.P.     10 =  +8 +2
  11:    ...1.11    ..P.M.M     11 =  +16 -4 -1
  12:    ...11..    ..P.M..     12 =  +16 -4
  13:    ...11.1    ..P.M.P     13 =  +16 -4 +1
  14:    ...111.    ..P..M.     14 =  +16 -2
  15:    ...1111    ..P...M     15 =  +16 -1
  16:    ..1....    ..P....     16 =  +16
  17:    ..1...1    ..P...P     17 =  +16 +1
  18:    ..1..1.    ..P..P.     18 =  +16 +2
This sequence gives the words obtained by keeping the 'P' (sum of positive terms in rightmost column), keeping the 'M' gives A184616 (negative sum of negative terms in rightmost column).
		

Crossrefs

A184616 (negated negative parts), A184617 (sums of both parts =A184615+A184616).
A007302 gives the number of nonzero bits ('M' and 'P' in example).

Programs

  • Mathematica
    bin2naf[x_] := Module[{xh, x3, c, np, nm},
      xh = BitShiftRight[x, 1];
      x3 = x + xh;
      c = BitXor[xh, x3];
      np = BitAnd[x3, c];
      nm = BitAnd[xh, c];
      Return[{np, nm}]];
    a[n_] := bin2naf[n][[1]];
    Table[a[n], {n, 0, 100}] (* Jean-François Alcover, May 30 2019, from PARI *)
  • PARI
    bin2naf(x)=
    { /* Compute (nonadjacent) signed binary representation of x: */
        local(xh,x3,c,np,nm);
        xh = x >> 1;
        x3 = x + xh;
        c = bitxor(xh, x3);
        np = bitand(x3, c);  /* bits == +1 */
        nm = bitand(xh, c);  /* bits == -1 */
        return([np,nm]);  /* np-nm==x */
    }
    { for(n=0,100, v = bin2naf(n); print1(v[1],", "); ); } /* show terms */
    { for(n=0,100, v = bin2naf(n); print1(v[2],", "); ); } /* terms of A184616 */
    { for(n=0,100, v = bin2naf(n); print1(v[1]+v[2],", "); ); } /* terms of A184617 */
    { for(n=0,100, v = bin2naf(n); print1(v[1]-v[2],", "); ); }  /* == n */

Formula

a(n) - A184616(n) = n
a(n) + A184616(n) = A184617(n)

A184616 Negated negative parts of the nonadjacent forms.

Original entry on oeis.org

0, 0, 0, 1, 0, 0, 2, 1, 0, 0, 0, 5, 4, 4, 2, 1, 0, 0, 0, 1, 0, 0, 10, 9, 8, 8, 8, 5, 4, 4, 2, 1, 0, 0, 0, 1, 0, 0, 2, 1, 0, 0, 0, 21, 20, 20, 18, 17, 16, 16, 16, 17, 16, 16, 10, 9, 8, 8, 8, 5, 4, 4, 2, 1, 0, 0, 0, 1, 0, 0, 2, 1, 0, 0, 0, 5, 4, 4, 2, 1, 0, 0, 0, 1, 0, 0, 42, 41
Offset: 0

Views

Author

Joerg Arndt, Jan 18 2011

Keywords

Comments

This sequence together with A184615 (positive parts) gives the (signed binary) nonadjacent form (NAF) of n, see fxtbook link and example in A184615.
No two adjacent bits in the binary representations of a(n) are 1.
No two adjacent bits in the binary representations of a(n)+A184615(n) are 1.

Examples

			(see A184615)
		

Crossrefs

Cf. A184615 (positive parts), A184617 (sums of both parts =A184615+A184616).

Programs

  • Mathematica
    bin2naf[x_] := Module[{xh, x3, c, np, nm},
      xh = BitShiftRight[x, 1];
      x3 = x + xh;
      c = BitXor[xh, x3];
      np = BitAnd[x3, c];
      nm = BitAnd[xh, c];
      Return[{np, nm}]];
    a[n_] := bin2naf[n][[2]];
    Table[a[n], {n, 0, 100}] (* Jean-François Alcover, May 30 2019, from PARI code in A184615 *)
  • PARI
    (see A184615)

Formula

A184615(n) - a(n) = n
a(n) + A184615(n) = A184617(n)

A380122 a(n) is the number of integers m (possibly negative) such that the nonzero digits in the nonadjacent form for m appear in the nonadjacent form for n.

Original entry on oeis.org

1, 2, 2, 4, 2, 4, 4, 4, 2, 4, 4, 8, 4, 8, 4, 4, 2, 4, 4, 8, 4, 8, 8, 8, 4, 8, 8, 8, 4, 8, 4, 4, 2, 4, 4, 8, 4, 8, 8, 8, 4, 8, 8, 16, 8, 16, 8, 8, 4, 8, 8, 16, 8, 16, 8, 8, 4, 8, 8, 8, 4, 8, 4, 4, 2, 4, 4, 8, 4, 8, 8, 8, 4, 8, 8, 16, 8, 16, 8, 8, 4, 8, 8, 16, 8
Offset: 0

Views

Author

Rémy Sigrist, Jan 12 2025

Keywords

Examples

			The nonadjacent form for 25 is "10T001" and has 3 nonzero digits, so a(25) = 2^3 = 8.
		

Crossrefs

Cf. A000120, A001316, A184617, A380123 (corresponding m's).

Programs

  • PARI
    a(n) = { my (v = 1); while (n, if (n%2, n -= 2 - (n%4); v *= 2; ); n \= 2; ); return (v); }

Formula

a(n) = 2^A000120(A184617(n)) = A001316(A184617(n)).

A377477 Consider the nonadjacent form for n, then reverse the digits, leaving any trailing zeros alone, and take the absolute value.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 19, 12, 13, 14, 15, 16, 17, 18, 11, 20, 21, 38, 35, 24, 29, 26, 39, 28, 25, 30, 31, 32, 33, 34, 23, 36, 41, 22, 27, 40, 37, 42, 83, 76, 45, 70, 67, 48, 61, 58, 51, 52, 77, 78, 71, 56, 57, 50, 79, 60, 49, 62, 63, 64, 65, 66, 47
Offset: 0

Views

Author

Rémy Sigrist, Dec 28 2024

Keywords

Comments

A self-inverse permutation of the nonnegative integers.

Examples

			For n = 22: the nonadjacent form for 22 is "10T0T0" (where T denotes -1), reversing the digits and leaving any trailing zeros alone yields "T0T010", so a(22) = |- 2^5 - 2^3 + 2^1| =  38.
		

Crossrefs

See A160652 and A345201 for similar sequences.

Programs

  • PARI
    \\ See Links section.

Formula

A184617(a(n)) = A057889(A184617(n)).
Showing 1-7 of 7 results.