login
This site is supported by donations to The OEIS Foundation.

 

Logo

Annual appeal: Please make a donation to keep the OEIS running! Over 6000 articles have referenced us, often saying "we discovered this result with the help of the OEIS".
Other ways to donate

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A030308 Triangle T(n,k): Write n in base 2, reverse order of digits, to get the n-th row. 194
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 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,1

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) = length of n-th row; A000120(n) = sum of n-th row; A030101(n) = n-th row seen as binary number; A000035(n) = T(n,0). - Reinhard Zumkeller, Jun 17 2012

LINKS

Reinhard Zumkeller, Rows n = 0..1023 of triangle, flattened

Index entries for sequences related to binary expansion of n

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

EXAMPLE

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

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 *)

PROG

(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

(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 xrange(0, 20): print list(map(int, 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

CROSSREFS

Cf. A030190.

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

Sequence in context: A022924 A157412 A023532 * A280237 A259044 A112690

Adjacent sequences:  A030305 A030306 A030307 * A030309 A030310 A030311

KEYWORD

nonn,base,easy,tabf

AUTHOR

Clark Kimberling

EXTENSIONS

Initial 0 and better name by Philippe Deléham, Oct 12 2011

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent | More pages
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy .

Last modified December 14 21:33 EST 2017. Contains 296020 sequences.