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-10 of 43 results. Next

A030343 Position of n-th 1 in A030341.

Original entry on oeis.org

1, 4, 5, 6, 8, 11, 17, 18, 20, 23, 25, 26, 27, 28, 29, 31, 32, 35, 36, 38, 41, 45, 52, 54, 55, 58, 63, 72, 73, 76, 80, 82, 84, 85, 86, 88, 90, 92, 96, 97, 100, 104, 107, 108, 109, 111, 112, 115, 116, 118, 119, 120, 121, 122, 123, 124, 126
Offset: 1

Views

Author

Keywords

A030350 a(n) = (# 1's)-(# 2's) in first n terms of A030341.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

For k >= 1, a(3^k * (k - 1/2) + 1/2) = 1 and a(3^k * (k - 1/2) + 3/2) = a(3^k * (k - 1/2) + 5/2) = 0. - Robert Israel, Jun 23 2024

Crossrefs

Cf. A030341.

Programs

  • Maple
    R:= 0: t:= 0:
    for i from 1 to 100 do
      L:= convert(i,base,3);
      for j from 1 to nops(L) do
        if L[j] = 1 then t:= t+1 elif L[j] = 2 then t:= t-1 fi;
        R:= R,t;
      od
    od:
    R; # Robert Israel, Jun 23 2024

Extensions

a(1) = 0 inserted by Robert Israel, Jun 23 2024

A030342 Position of n-th 0 in A030341.

Original entry on oeis.org

0, 3, 9, 15, 16, 19, 22, 24, 33, 42, 43, 46, 49, 51, 60, 69, 70, 71, 74, 75, 78, 79, 81, 83, 87, 91, 93, 95, 99, 103, 105, 106, 110, 114, 117, 129, 141, 142, 146, 150, 153, 165, 177, 178, 179, 182, 183, 186, 187, 189, 191, 195, 199, 201
Offset: 1

Views

Author

Keywords

Extensions

Initial 0 inserted for consistency with change in A030341 by Sean A. Irvine, Mar 31 2020

A030344 Position of n-th 2 in A030341.

Original entry on oeis.org

2, 7, 10, 12, 13, 14, 21, 30, 34, 37, 39, 40, 44, 47, 48, 50, 53, 56, 57, 59, 61, 62, 64, 65, 66, 67, 68, 77, 89, 94, 98, 101, 102, 113, 125, 130, 134, 137, 138, 143, 147, 149, 151, 155, 159, 161, 163, 166, 167, 170, 171, 173, 174, 175
Offset: 1

Views

Author

Keywords

Crossrefs

Cf. A030341.

A030345 a(n)=least k such that base 3 representation of n begins at s(k), where s=A030341.

Original entry on oeis.org

1, 2, 8, 4, 1, 2, 7, 12, 41, 18, 8, 17, 4, 5, 1, 6, 11, 14, 2, 48, 7, 30, 10, 13, 39, 12, 176, 73, 41, 80, 23, 18, 92, 8, 45, 72, 17, 31, 84, 25, 4, 96, 5, 54, 76, 1, 58, 6, 29, 36, 100, 38, 11, 68, 14, 185, 21, 2, 50, 48, 149, 59, 40, 89, 7, 30
Offset: 1

Views

Author

Keywords

A030346 Length of n-th run of digit 0 in A030341.

Original entry on oeis.org

1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 3, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 3, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 4, 3, 3, 1, 2, 2, 2, 1, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
Offset: 1

Views

Author

Keywords

Programs

  • Mathematica
    If[#[[1]]==0,Length[#],Nothing]&/@Split[Flatten[Table[Reverse[IntegerDigits[n,3]],{n,0,200}]]] (* Harvey P. Dale, Mar 14 2023 *)

Extensions

Initial 1 inserted for consistency with change in A030341 by Sean A. Irvine, Mar 31 2020

A030347 Length of n-th run of digit 1 in A030341.

Original entry on oeis.org

1, 3, 1, 1, 2, 1, 1, 5, 2, 2, 1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 1, 3, 1, 1, 1, 2, 1, 1, 3, 2, 2, 7, 3, 3, 2, 2, 2, 1, 1, 1, 3, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 3, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 1, 3, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 2, 4, 1, 2, 1
Offset: 1

Views

Author

Keywords

Programs

  • Mathematica
    Length/@Select[Split[Flatten[Table[Reverse[IntegerDigits[n,3]],{n,0,100}]]],First[#]==1&] (* Harvey P. Dale, Oct 20 2014 *)

A030348 Length of n-th run of digit 2 in A030341.

Original entry on oeis.org

1, 1, 1, 3, 1, 1, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 5, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 1, 2, 1, 1, 2, 1, 1, 1, 1, 3, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 3, 1, 2, 3, 2, 2, 3, 2, 3, 7, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 1
Offset: 1

Views

Author

Keywords

A030349 (# 1's)-(# 0's) in first n terms of A030341.

Original entry on oeis.org

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

Views

Author

Keywords

Programs

  • Mathematica
    Accumulate[Which[#==1,1,#==0,-1,True,0]&/@Flatten[Table[Reverse[IntegerDigits[n,3]],{n,40}]]] (* Harvey P. Dale, Jul 25 2024 *)

A030308 Triangle T(n, k): Write n in base 2, reverse order of digits, to get the n-th row.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

This is the quite common, so-called "bittest" function, see PARI code. - M. F. Hasler, Jul 21 2013
For a given number m and a digit position k the corresponding sequence index n can be calculated by n(m, k) = m*(1 + floor(log_2(m))) - 2^(1 + floor(log_2(m))) + k + 1. For example: counted from right to left, the second digit of m = 13 (binary 1101) is '0'. Hence the sequence index is n = n(13, 2) = 39. - Hieronymus Fischer, May 05 2007
A070939(n) is the length of n-th row; A000120(n) is the sum of n-th row; A030101(n) is the n-th row seen as binary number; A000035(n) = T(n, 0). - Reinhard Zumkeller, Jun 17 2012

Examples

			Triangle begins :
0
1
0, 1
1, 1
0, 0, 1
1, 0, 1
0, 1, 1
1, 1, 1
0, 0, 0, 1
1, 0, 0, 1 - _Philippe Deléham_, Oct 12 2011
		

Crossrefs

Cf. A030190.
Cf. A030341, A030386, A031235, A030567, A031007, A031045, A031087, A031298 for the base-3 to base-10 analogs.

Programs

  • Haskell
    a030308 n k = a030308_tabf !! n !! k
    a030308_row n = a030308_tabf !! n
    a030308_tabf = iterate bSucc [0] where
       bSucc []       = [1]
       bSucc (0 : bs) = 1 : bs
       bSucc (1 : bs) = 0 : bSucc bs
    -- Reinhard Zumkeller, Jun 17 2012
    
  • Maple
    A030308_row := n -> op(convert(n,base, 2)):
    seq(A030308_row(n), n=0..23); # Peter Luschny, Nov 28 2017
  • Mathematica
    Flatten[Table[Reverse[IntegerDigits[n, 2]], {n, 0, 23}]] (* T. D. Noe, Oct 12 2011 *)
  • PARI
    A030308(n,k)=bittest(n,k) \\ Assuming that columns are numbered starting with k=0, as suggested by the formula from R. Zumkeller. - M. F. Hasler, Jul 21 2013
    
  • Python
    for n in range(20): print([int(z) for z in str(bin(n)[2:])[::-1]]) # Indranil Ghosh, Mar 31 2017
    
  • Sage
    A030308_row = lambda n: n.bits() if n > 0 else [0]
    for n in (0..23): print(A030308_row(n)) # Peter Luschny, Nov 28 2017
    
  • Scala
    (0 to 31).map(Integer.toString(, 2).reverse).mkString.split("").map(Integer.parseInt()).toList // Alonso del Arte, Feb 10 2020

Formula

a(n) = floor(m/2^(k - 1)) mod 2, where m = max(j|A001855(j) < n) and k = n - A001855(m). - Hieronymus Fischer, May 05 2007, Sep 10 2007
T(n, k) = (n // 2^k) mod 2, for 0 <= k <= log[2](n) and n > 0; T(0, 0) = 0. ('//' denotes integer division). - Peter Luschny, Apr 20 2023

Extensions

Initial 0 and better name by Philippe Deléham, Oct 12 2011
Showing 1-10 of 43 results. Next