login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A082404 Triangle in which n-th row gives trajectory of n under the map x -> x/2 if x is even, x -> x-1 if x is odd, stopping when we reach 1. 2
1, 2, 1, 3, 2, 1, 4, 2, 1, 5, 4, 2, 1, 6, 3, 2, 1, 7, 6, 3, 2, 1, 8, 4, 2, 1, 9, 8, 4, 2, 1, 10, 5, 4, 2, 1, 11, 10, 5, 4, 2, 1, 12, 6, 3, 2, 1, 13, 12, 6, 3, 2, 1, 14, 7, 6, 3, 2, 1, 15, 14, 7, 6, 3, 2, 1, 16, 8, 4, 2, 1, 17, 16, 8, 4, 2, 1 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,2

COMMENTS

If you write down 0 when dividing by 2, 1 when subtracting 1, the trajectory gives the binary expansion of n.

The length of the n-th row of the triangle is A056792(n). - Nathaniel Johnston, Apr 21 2011

LINKS

Nathaniel Johnston, Table of n, a(n) for n = 1..10000

FORMULA

T(n, 1) = n, T(n, 2) = A029578(n).

EXAMPLE

Triangle begins:

  1;

  2, 1;

  3, 2, 1;

  4, 2, 1,

  5, 4, 2, 1;

  6, 3, 2, 1;

  7, 6, 3, 2, 1;

  8, 4, 2, 1;

  9, 8, 4, 2, 1;

  ...

MAPLE

A082404 := proc(n, k) option remember: if(k = 1)then return n:elif(A082404(n, k-1) mod 2 = 0)then return A082404(n, k-1)/2: else return A082404(n, k-1)-1: fi: end:

for n from 1 to 20 do k:=1: while A082404(n, k)>=1 do printf("%d, ", A082404(n, k)); k:=k+1: od:printf("\n"); od: # Nathaniel Johnston, Apr 21 2011

CROSSREFS

Cf. A056792, A080825.

Sequence in context: A308780 A246700 A073932 * A334725 A120885 A234575

Adjacent sequences:  A082401 A082402 A082403 * A082405 A082406 A082407

KEYWORD

easy,nonn,tabf

AUTHOR

Cino Hilliard, Apr 14 2003

EXTENSIONS

More terms and changed offset from Nathaniel Johnston, Apr 21 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
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 23 12:53 EDT 2020. Contains 337310 sequences. (Running on oeis4.)