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

A353660 The binary expansions of A352909(n+1, 1) and A352909(n+1, 2) encode respectively the 1's and the 2's in the ternary expansion of a(n).

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, May 02 2022

Keywords

Comments

This sequence is a permutation of the nonnegative integers with inverse A353661.

Examples

			For n = 42:
- A352909(43, 1) = 9,
- A352909(43, 2) = 2,
- the binary expansion of 9 is "1001",
- the binary expansion of 2 is "10",
- so the ternary expansion of a(42) is "1021",
- and a(42) = 34.
		

Crossrefs

Cf. A005836, A352909, A353661 (inverse), A353662.

Programs

  • PARI
    b2t(n) = fromdigits(binary(n), 3)
    { n=-1; for (d=0, 2^8-1, for (k=0, d, if (bitand(t1=k, t2=d-k)==0, print1 (b2t(t1) + 2*b2t(t2)", "); if (n++==67, break (2))))) }

Formula

a(n) = A005836(A352909(n+1, 1)) + 2*A005836(A352909(n+1, 2)).
a(n) < 3^k iff n < 3^k.

A353662 The binary expansions of A352909(n+1, 1) and A352909(n+1, 2) encode respectively the 1's and the -1's in the balanced ternary expansion of a(n).

Original entry on oeis.org

0, -1, 1, -3, 3, -4, -2, 2, 4, -9, 9, -10, -8, 8, 10, -12, -6, 6, 12, -13, -11, -7, -5, 5, 7, 11, 13, -27, 27, -28, -26, 26, 28, -30, -24, 24, 30, -31, -29, -25, -23, 23, 25, 29, 31, -36, -18, 18, 36, -37, -35, -19, -17, 17, 19, 35, 37, -39, -33, -21, -15, 15
Offset: 0

Views

Author

Rémy Sigrist, May 02 2022

Keywords

Comments

This sequence is a permutation from the nonnegative integers onto the integers (Z).

Examples

			For n = 42:
- A352909(43, 1) = 9,
- A352909(43, 2) = 2,
- the binary expansion of 9 is "1001",
- the binary expansion of 2 is "10",
- so the balanced ternary expansion of a(42) is "10T1",
- and a(42) = 25.
		

Crossrefs

Programs

  • PARI
    b2t(n) = fromdigits(binary(n), 3)
    { n=-1; for (d=0, 2^8-1, for (k=0, d, if (bitand(t1=k, t2=d-k)==0, print1 (b2t(t1) - b2t(t2)", "); if (n++==61, break (2))))) }

Formula

a(n) = A005836(A352909(n+1, 1)) - A005836(A352909(n+1, 2)).
a(n) = A117966(A353660(n)).
Sum_{k = 0..n} a(k) = 0 iff n = 0 or n belongs to A074330.

A352910 The j-values of pairs (i,j) listed in A352909.

Original entry on oeis.org

0, 1, 0, 2, 0, 3, 2, 1, 0, 4, 0, 5, 4, 1, 0, 6, 4, 2, 0, 7, 6, 5, 4, 3, 2, 1, 0, 8, 0, 9, 8, 1, 0, 10, 8, 2, 0, 11, 10, 9, 8, 3, 2, 1, 0, 12, 8, 4, 0, 13, 12, 9, 8, 5, 4, 1, 0, 14, 12, 10, 8, 6, 4, 2, 0, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 16, 0
Offset: 1

Views

Author

N. J. A. Sloane, Apr 09 2022

Keywords

Comments

See A295989 for the i-values.

Crossrefs

Programs

  • Mathematica
    A352910list[ij_] := Select[Range[ij, 0, -1], BitAnd[#, ij-#] == 0 &];
    Flatten[Array[A352910list, 25, 0]] (* Paolo Xausa, Feb 24 2024 *)

A295989 Irregular triangle T(n, k), read by rows, n >= 0 and 0 <= k < A001316(n): T(n, k) is the (k+1)-th nonnegative number m such that n AND m = m (where AND denotes the bitwise AND operator).

Original entry on oeis.org

0, 0, 1, 0, 2, 0, 1, 2, 3, 0, 4, 0, 1, 4, 5, 0, 2, 4, 6, 0, 1, 2, 3, 4, 5, 6, 7, 0, 8, 0, 1, 8, 9, 0, 2, 8, 10, 0, 1, 2, 3, 8, 9, 10, 11, 0, 4, 8, 12, 0, 1, 4, 5, 8, 9, 12, 13, 0, 2, 4, 6, 8, 10, 12, 14, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0
Offset: 0

Views

Author

Rémy Sigrist, Dec 02 2017

Keywords

Comments

The (n+1)-th row has A001316(n) terms and sums to n * A001316(n) / 2.
For any n >= 0 and k such that 0 <= k < A001316(n):
- if A000120(n) > 0 then T(n, 1) = A006519(n),
- if A000120(n) > 1 then T(n, 2) = 2^A285099(n),
- if A000120(n) > 0 then T(n, A001316(n)/2 - 1) = A053645(n),
- if A000120(n) > 0 then T(n, A001316(n)/2) = 2^A000523(n),
- if A000120(n) > 0 then T(n, A001316(n) - 2) = A129760(n),
- T(n, A001316(n) - 1) = n,
- the six previous relations correspond respectively (when applicable) to the second term, the third term, the pair of central terms, the penultimate term and the last term of a row,
- T(n, k) AND T(n, A001316(n) - k - 1) = 0,
- T(n, k) + T(n, A001316(n) - k - 1) = n,
- T(n, k) = k for any k < A006519(n+1),
- A000120(T(n, k)) = A000120(k).
If we plot (n, T(n,k)) then we obtain a skewed Sierpinski triangle (see Links section).
If interpreted as a flat sequence a(n) for n >= 0:
- a(n) = 0 iff n = A006046(k) for some k >= 0,
- a(n) = 1 iff n = A006046(2*k + 1) + 1 for some k >= 0,
- a(A006046(k) - 1) = k - 1 for any k > 0.

Examples

			Triangle begins:
  0:   [0]
  1:   [0, 1]
  2:   [0, 2]
  3:   [0, 1, 2, 3]
  4:   [0, 4]
  5:   [0, 1, 4, 5]
  6:   [0, 2, 4, 6]
  7:   [0, 1, 2, 3, 4, 5, 6, 7]
  8:   [0, 8]
  9:   [0, 1, 8, 9]
  10:  [0, 2, 8, 10]
  11:  [0, 1, 2, 3, 8, 9, 10, 11]
  12:  [0, 4, 8, 12]
  13:  [0, 1, 4, 5, 8, 9, 12, 13]
  14:  [0, 2, 4, 6, 8, 10, 12, 14]
  15:  [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
		

Crossrefs

First column of array in A352909.

Programs

  • Mathematica
    A295989row[n_] := Select[Range[0, n], BitAnd[#, n-#] == 0 &];
    Array[A295989row, 25, 0] (* Paolo Xausa, Feb 24 2024 *)
  • PARI
    T(n,k) = if (k==0, 0, n%2==0, 2*T(n\2,k), k%2==0, 2*T(n\2, k\2), 2*T(n\2, k\2)+1)

Formula

For any n >= 0 and k such that 0 <= k < A001316(n):
- T(n, 0) = 0,
- T(2*n, k) = 2*T(n, k),
- T(2*n+1, 2*k) = 2*T(n, k),
- T(2*n+1, 2*k+1) = 2*T(n, k) + 1.

A352911 Cantor's List: Pairs (i, j) of relatively prime positive integers sorted first by i + j then by i.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Apr 09 2022

Keywords

Comments

a(2*n-1) / a(2*n) is the n-th fraction in Cantor's enumeration of the positive rational numbers. - Peter Luschny, Oct 10 2023

Examples

			The first few pairs are, seen as an irregular triangle:
  [1, 1],
  [1, 2], [2, 1],
  [1, 3], [3, 1],
  [1, 4], [2, 3], [3, 2], [4, 1],
  [1, 5], [5, 1],
  [1, 6], [2, 5], [3, 4], [4, 3], [5, 2], [6, 1],
  [1, 7], [3, 5], [5, 3], [7, 1],
  [1, 8], [2, 7], [4, 5], [5, 4], [7, 2], [8, 1],
  [1, 9], [3, 7], [7, 3], [9, 1],
  ...
		

Crossrefs

Cf. A352909, A020652 or A038566 (i-coordinates), A020653 (j-coordinates), A366191.

Programs

  • Maple
    CantorsList := proc(upto) local C, F, n, t, count;
    C := NULL; count := 0:
    for n from 2 while count < upto do
        F := select(t -> igcd(t, n-t) = 1, [$1..n-1]);
        C := C, seq([t, n - t], t = F);
        count := count + nops(F) od:
    ListTools:-Flatten([C]) end:
    CantorsList(40);  # Peter Luschny, Oct 10 2023
  • Mathematica
    A352911row[n_]:=Select[Array[{#,n-#}&,n-1],CoprimeQ[First[#],Last[#]]&];
    Array[A352911row,10,2] (* Generates 10 rows *) (* Paolo Xausa, Oct 10 2023 *)
  • Python
    from math import gcd
    from itertools import chain, count, islice
    def A352911_gen(): # generator of terms
        return chain.from_iterable((i,n-i) for n in count(2) for i in range(1,n) if gcd(i,n-i)==1)
    A352911_list = list(islice(A352911_gen(),30)) # Chai Wah Wu, Oct 10 2023

A054240 Bit-interleaved number addition table; like binary addition but carries shift 2 instead of 1; addition base sqrt(2).

Original entry on oeis.org

0, 1, 1, 2, 4, 2, 3, 3, 3, 3, 4, 6, 8, 6, 4, 5, 5, 9, 9, 5, 5, 6, 16, 6, 12, 6, 16, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 18, 12, 18, 16, 18, 12, 18, 8, 9, 9, 13, 13, 17, 17, 13, 13, 9, 9, 10, 12, 10, 24, 18, 20, 18, 24, 10, 12, 10, 11, 11, 11, 11, 19, 19, 19, 19, 11, 11, 11, 11, 12, 14, 32, 14
Offset: 0

Views

Author

Marc LeBrun, Feb 07 2000

Keywords

Examples

			T(3,1)=6 because (0*2 + 1*sqrt(2) + 1*1) + (0*2 + 0*sqrt(2) + 1*1) = (1*2 + 1*sqrt(2) + 0*1) (i.e., base sqrt(2) addition).
		

Crossrefs

Cf. A000695, A054239, A057300, A062880, A352909 (pairs (i,j) such that A(i,j) = i+j).
Cf. A201651 (triangle read by rows).

Programs

  • Haskell
    import Data.Bits (xor, (.&.), shift)
    a054240 :: Integer -> Integer -> Integer
    a054240 x 0 = x
    a054240 x y = a054240 (x `xor` y) (shift (x .&. y) 2)
    a054240_adiag n =  map (\k -> a054240 (n - k) k) [0..n]
    a054240_square = map a054240_adiag [0..]
    -- Reinhard Zumkeller, Dec 03 2011

Formula

From Peter Munn, Dec 10 2019: (Start)
A(m,0) = A(0,m) = m.
A(n,k) = A(k,n).
A(n, A(m,k)) = A(A(n,m), k).
A(m,m) = 4*m.
A(2*n, 2*k) = 2*A(n,k).
A(A000695(n), A000695(k)) = A000695(n+k).
A(A000695(n), 2*A000695(k)) = A000695(n) + 2*A000695(k).
A(A000695(n) + 2*A000695(m), k) = A(A000695(n), k) + A(2*A000695(m), k) - k.
A(A057300(n), A057300(k)) = A057300(A(n,k)).
(End)

A353296 Pairs (i,j) of positive integers with at least one common 1-bit sorted first by i+j then by i.

Original entry on oeis.org

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

Views

Author

Rémy Sigrist and N. J. A. Sloane, Apr 09 2022

Keywords

Comments

Pairs (i,j) with AND(i,j) <> 0.
See A352909 for the other pairs.
There are A048967(n) pairs (i,j) with n = i+j.

Examples

			The first pairs are:
    [1, 1],
    [1, 3], [2, 2], [3, 1],
    [2, 3], [3, 2],
    [1, 5], [3, 3], [5, 1],
    [1, 7], [2, 6], [3, 5], [4, 4], [5, 3], [6, 2], [7, 1],
    [2, 7], [3, 6], [4, 5], [5, 4], [6, 3], [7, 2],
    [1, 9], [3, 7], [4, 6], [5, 5], [6, 4], [7, 3], [9, 1],
    ...
		

Crossrefs

Cf. A004198, A048967, A352909, A353297 (i values), A353298 (j values).

Programs

  • Mathematica
    A353296row[ij_] := Select[Array[{#, ij-#} &, ij], BitAnd @@ # > 0 &];
    Array[A353296row, 15] (* Paolo Xausa, Feb 24 2024 *)
  • PARI
    for (ij=1, 12, for (i=1, ij, j=ij-i; if (bitand(i,j), print1(i", "j", "))))

A362326 Pairs (i, j) of nonnegative integers whose ternary expansions have no common digit 1 sorted first by i + j then by i.

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Apr 16 2023

Keywords

Comments

This sequence is to Sierpinski carpet what A352909 is to Sierpinski gasket.
There are A293974(n + 1) pairs (i, j) with n = i + j.
See A362329 for the other pairs.

Examples

			The first pairs are:
    (0, 0),
    (0, 1), (1, 0),
    (0, 2), (2, 0),
    (0, 3), (1, 2), (2, 1), (3, 0),
    (0, 4), (1, 3), (2, 2), (3, 1), (4, 0),
    (0, 5), (2, 3), (3, 2), (5, 0),
    (0, 6), (1, 5), (2, 4), (4, 2), (5, 1), (6, 0),
    (0, 7), (1, 6), (2, 5), (5, 2), (6, 1), (7, 0),
    (0, 8), (2, 6), (6, 2), (8, 0),
    ...
		

Crossrefs

Cf. A293974, A352909, A362327 (i-values), A362328 (j-values), A362329 (complement).

Programs

  • PARI
    is(i, j) = { while (i && j, if (i%3==1 && j%3==1, return (0), i\=3; j\=3;);); return (1); }
    row(ij) = apply (i -> [i, ij-i], select(i -> is(i, ij-i), [0..ij]))
Showing 1-8 of 8 results.