The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation. Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A003817 a(0) = 0, a(n) = a(n-1) OR n. 24
 0, 1, 3, 3, 7, 7, 7, 7, 15, 15, 15, 15, 15, 15, 15, 15, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63 (list; graph; refs; listen; history; text; internal format)
 OFFSET 0,3 COMMENTS Also, 0+1+2+...+n in lunar arithmetic in base 2 written in base 10. - N. J. A. Sloane, Oct 02 2010 Comment from Michel ten Voorde, Jun 20 2001: Consider 'triangles' with lengths n X n, constructed of unit squares. Then a(n) is the minimal number of squares (of any size) whose union is the triangle. The triangle for n=4 is: .__.__.__.__ |1.|2.|3.|4.| |__|__|__|__| ...|5.|6.|7.| ...|__|__|__| ......|8.|9.| ......|__|__| .........|10| .........|__| The minimal number of squares to cover this is 7, namely square 3-4-6-7, square 1, square 2, square 5, square 8, square 9 and square 10. For n>0: replace all 0's with 1's in binary representation of n. - Reinhard Zumkeller, Jul 14 2003 LINKS R. Zumkeller, Table of n, a(n) for n = 0..10000 [From Reinhard Zumkeller, Nov 14 2009] D. Applegate, M. LeBrun and N. J. A. Sloane, Dismal Arithmetic, arXiv:1107.1130 [math.NT], 2011. [Note: we have now changed the name from "dismal arithmetic" to "lunar arithmetic" - the old name was too depressing] R. Stephan, Some divide-and-conquer sequences ... R. Stephan, Table of generating functions R. Stephan, Divide-and-conquer generating functions. I. Elementary sequences, arXiv:math/0307027 [math.CO], 2003. R. Zumkeller, Logical Convolutions FORMULA a(n) = a(n-1) + n*(1-floor(a(n-1)/n)). If 2^(k-1)<= n < 2^k, a(n) = 2^k-1. - Benoit Cloitre, Aug 25 2002 a(n) = 1 + 2*a(floor(n/2)) for n > 0. - Benoit Cloitre, Apr 04 2003 G.f.: 1/(1-x) * Sum_{k>=0} 2^k*x^2^k. - Ralf Stephan, Apr 18 2003 a(n) = 2*A053644(n)-1 = A092323(n) + A053644(n). - Reinhard Zumkeller, Feb 15 2004; corrected by Anthony Browne, Jun 26 2016 a(n) = OR{k OR (n-k): 0<=k<=n}. - Reinhard Zumkeller, Jul 15 2008 For n>0: a(n+1) = A035327(n) + n = A035327(n) XOR n. - Reinhard Zumkeller, Nov 14 2009 A092323(n+1) = floor(a(n)/2). - Reinhard Zumkeller, Jul 18 2010 a(n) = A265705(n,0) = A265705(n,n). - Reinhard Zumkeller, Dec 15 2015 a(n) = A062383(n) - 1. G.f. A(x) satisfies: A(x) = 2*A(x^2)*(1 + x) + x/(1 - x). - Ilya Gutkovskiy, Aug 31 2019 MAPLE A003817 := n -> n + Bits:-Nand(n, n): seq(A003817(n), n=0..61); # Peter Luschny, Sep 23 2019 MATHEMATICA a = 0; a[n_] := a[n] = BitOr[ a[n-1], n]; Table[a[n], {n, 0, 61}] (* Jean-François Alcover, Dec 19 2011 *) nxt[{n_, a_}]:={n+1, BitOr[a, n+1]}; Transpose[NestList[nxt, {0, 0}, 70]] [] (* Harvey P. Dale, May 06 2016 *) PROG (PARI) a(n)=1<<(log(2*n+1)\log(2))-1 \\ Charles R Greathouse IV, Dec 08 2011 (Haskell) import Data.Bits ((.|.)) a003817 n = if n == 0 then 0 else 2 * a053644 n - 1 a003817_list = scanl (.|.) 0 [1..] :: [Integer] -- Reinhard Zumkeller, Dec 08 2012, Jan 15 2012 (Python) def a(n): return 0 if n==0 else 1 + 2*a(int(n/2)) # Indranil Ghosh, Apr 28 2017 CROSSREFS This is Guy Steele's sequence GS(6, 6) (see A135416). Cf. A000004, A142149, A086099, A142150, A142151, A001477, A062383. Cf. A167832, A167878. - Reinhard Zumkeller, Nov 14 2009 Cf. A179526; subsequence of A007448. - Reinhard Zumkeller, Jul 18 2010 Cf. A265705. Sequence in context: A160515 A105670 A283996 * A092474 A225851 A107470 Adjacent sequences:  A003814 A003815 A003816 * A003818 A003819 A003820 KEYWORD nonn,base,nice AUTHOR 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.

Last modified April 17 05:12 EDT 2021. Contains 343059 sequences. (Running on oeis4.)