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.
%I A138591 #81 Jul 05 2025 05:29:21 %S A138591 1,3,5,6,7,9,10,11,12,13,14,15,17,18,19,20,21,22,23,24,25,26,27,28,29, %T A138591 30,31,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53, %U A138591 54,55,56,57,58,59,60,61,62,63,65,66,67,68,69,70,71,72,73,74,75,76,77 %N A138591 Sums of two or more consecutive nonnegative integers. %C A138591 Closely related to but different from A057716. - _N. J. A. Sloane_, May 16 2008 %C A138591 These are called polite numbers [From Howard Berman (howard_berman(AT)hotmail.com), Oct 29 2008] by those who require nonnegative integers in the definition as opposed to positive integers. With the latter requirement, 1 = 0 + 1 does not count as a polite number. [This difference of definition pointed out by Ant King (Nov 19 2010)] There is no disagreement that 1 belongs in this sequence, but there is disagreement as to whether it counts as a polite number. - _Ant King_, Nov 19 2010 %C A138591 Of course sums of two or more consecutive nonpositive integers have the same absolute values (noted while inserting "nonnegative" in title). All integers are sums of two or more consecutive integers without such restriction. - _Rick L. Shepherd_, Jun 03 2014 %C A138591 In K-12 education, these are known as "staircase numbers." The "1" is often omitted. - _Gordon Hamilton_, Mar 17 2015 %C A138591 Complement of A155559. - _Ray Chandler_, Mar 23 2016 %C A138591 Exactly the positive integers without nontrivial powers of two (i.e., 2^k, k > 0). That is, the same as A057716 except for the first term of both sequences. - _M. F. Hasler_, Jul 04 2025 %D A138591 A. Wah and H. Picciotto, Algebra: Themes, Tools, Concepts, 1994, page 190. %H A138591 Ray Chandler, <a href="/A138591/b138591.txt">Table of n, a(n) for n = 1..10000</a> %H A138591 Tom M. Apostol, <a href="https://doi.org/10.1017/S002555720017216X">Sums of Consecutive Positive Integers</a>, The Mathematical Gazette, Vol. 87, No. 508, (March 2003). %H A138591 Ron Knott, <a href="https://www.maths.surrey.ac.uk/hosted-sites/R.Knott/runsums/index.html">An Introduction to Runsums</a> %H A138591 NRICH, <a href="https://nrich.maths.org/problems/polite-numbers-0">Polite numbers</a> %H A138591 Melfried Olson, <a href="https://www.jstor.org/stable/2689781">Sequentially so</a>, Mathematics Magazine 52:5, pp. 297-298. %H A138591 Erzsébet Orosz, <a href="https://ami.ektf.hu/uploads/papers/finalpdf/AAPASM_31_from125to129.pdf">On odd-summing numbers</a>, Acta Academiae Paedagogicae Agriensis, Sectio Mathematicae 31 (2004), pp. 125-129. %H A138591 Henri Picciotto's Math Education Page, <a href="https://www.mathedpage.org/teachers/staircases.pdf">Staircases</a> %H A138591 PlanetMath, <a href="https://planetmath.org/politenumber">Polite number</a> %H A138591 Wai Yan Pong, <a href="https://doi.org/10.1080/07468342.2007.11922226">Sums of consecutive integers</a>, The College Mathematics Journal, 38 (2007), 119-123. %H A138591 J. M. Rodriguez Caballero, <a href="https://www.jstor.org/stable/48661362">A Characterization of the Hypotenuses of Primitive Pythagorean Triangles Using Partitions into Consecutive Parts</a>, Amer. Math. Monthly 126 (2019), 74-77. %H A138591 Wikipedia, <a href="https://en.wikipedia.org/wiki/Polite_number">Polite number</a> %F A138591 a(n) = n + A000523(n + A000523(n)). - _Charles R Greathouse IV_, Aug 12 2010 %e A138591 0+1=1, 1+2=3, 2+3=5, 1+2+3=6, 3+4=7, 4+5=9, 1+2+3+4=10, ... %t A138591 1 + # + Floor[Log[2, # + 1 + Log[2, # + 1]]] &/@Range[0, 70] (* _Ant King_, Nov 18 2010 *) %o A138591 (PARI) a(n)=n+logint(n+logint(n,2),2) \\ _Charles R Greathouse IV_, Sep 01 2015 %o A138591 (PARI) is(n)=n>>valuation(n,2)>1 || n==1 \\ _Charles R Greathouse IV_, Aug 01 2016 %o A138591 (PARI) is_A138591(n)=hammingweight(n)>1||n==1 \\ _M. F. Hasler_, Jul 04 2025 %o A138591 (Python) %o A138591 def A138591(n): return len(bin(n+len(bin(n))-3)) + n - 3 # _Chai Wah Wu_, Feb 18 2022 %o A138591 (Python) %o A138591 A138591 = lambda n: n+(n+n.bit_length()-1).bit_length()-1 %o A138591 is_A138591 = lambda n: n.bit_count()>1 or n==1 # _M. F. Hasler_, Jul 04 2025 %o A138591 (C#) BigInteger a(BigInteger n) => (n + n.GetBitLength() - 1).GetBitLength() + n - 1; // _Delbert L. Johnson_, Mar 12 2023 %Y A138591 Cf. A155559 (complement), A057716 (nonpowers of 2: essentially the same), A000079 (powers of 2). %K A138591 nonn,easy %O A138591 1,2 %A A138591 _Vladimir Joseph Stephan Orlovsky_, May 13 2008 %E A138591 More terms from _Carl R. White_, Jul 22 2009