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

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A080079 Least number causing the longest carry sequence when adding numbers <= n to n in binary representation. 16
1, 2, 1, 4, 3, 2, 1, 8, 7, 6, 5, 4, 3, 2, 1, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,2

COMMENTS

T(n,k)<T(n,a(n))=A070940(n) for 1<=k<a(n) and T(n,k)<=T(n,a(n)) for a(n)<=k<=n, where T is defined as in A080080.

a(n) = n iff n=2^k, a(n) = A035327(n-1) otherwise. Equals A062383(n)-n. - Ralf Stephan, Jun 02 2003

a(n) = A240769(n,1); A240769(n,a(n)) = 1. - Reinhard Zumkeller, Apr 13 2014

a(n) = n + 1 - A006257(n). - Reinhard Zumkeller, Apr 14 2014

LINKS

Reinhard Zumkeller, Table of n, a(n) for n = 1..10000

Index entries for sequences related to binary expansion of n

FORMULA

a(n)=A004755(n)-2n; a(n)=-n+2*2^floor(log(n)/log(2)). - Benoit Cloitre, Feb 22 2003

a(0) = 0, a(2n) = 2a(n), a(2n+1) = 2a(n)-1+2[n==0]. - Ralf Stephan, Jan 04 2004

MATHEMATICA

Flatten@Table[Nest[Most[RotateRight[#]] &, Range[n], n - 1], {n, 30}] (* Birkas Gyorgy, Feb 07 2011 *)

Table[FromDigits[(IntegerDigits[n, 2] /. {0 -> 1, 1 -> 0}), 2] +

1, {n, 30}] (* Birkas Gyorgy, Feb 07 2011 *)

Table[BitXor[n, 2^IntegerPart[Log[2, n] + 1] - 1] + 1, {n, 30}] (* Birkas Gyorgy, Feb 07 2011 *)

Table[2 2^Floor[Log[2, n]] - n, {n, 30}] (* Birkas Gyorgy, Feb 07 2011 *)

Flatten@Table[Reverse@Range[2^n], {n, 0, 4}] (* Birkas Gyorgy, Feb 07 2011 *)

PROG

(Haskell)

a080079 n = (length $ takeWhile (< a070940 n) (a080080_row n)) + 1

-- Reinhard Zumkeller, Apr 22 2013

(MAGMA) [-n+2*2^Floor(Log(n)/Log(2)): n in [1..80]]; // Vincenzo Librandi, Dec 01 2016

CROSSREFS

Sequence in context: A281589 A302436 A283167 * A318569 A277749 A227629

Adjacent sequences:  A080076 A080077 A080078 * A080080 A080081 A080082

KEYWORD

nonn,base

AUTHOR

Reinhard Zumkeller, Jan 26 2003

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 October 21 19:27 EDT 2018. Contains 316428 sequences. (Running on oeis4.)