Recursion (computer science): Difference between revisions

From formulasearchengine
Jump to navigation Jump to search
en>Gilliam
m Reverted edits by 70.39.186.14 (talk) to last version by MMSequeira
en>Jochen Burghardt
Undid revision 641649464 by 92.3.36.61 (talk): already linked above
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
[[File:Young 456 French.svg|thumb|160px|A [[Young diagram]] representing visually the polite expansion 15 = 4 + 5 + 6]]
Marvella is what you can call her but it's not the most feminine title out there. Hiring is her day job now but she's usually needed her own company. Playing baseball is the hobby he will never quit performing. Years in the past we moved to North Dakota.<br><br>Here is my website; [http://xrambo.com/blog/192034 xrambo.com]
In [[number theory]], a '''polite number''' is a [[positive integer]] that can be written as the sum of two or more consecutive positive integers. Other positive integers are '''impolite'''.<ref name="Adams1993">{{citation
| last = Adams | first = Ken
| date = March 1993
| issue = 478
| journal = The Mathematical Gazette
| pages = 79–80
| title = How polite is ''x''?
| volume = 77
| doi = 10.2307/3619263
| jstor = 3619263}}.</ref><ref name="Griggs1991">{{citation
| last = Griggs | first = Terry S.
| date = December 1991
| issue = 474
| journal = The Mathematical Gazette
| pages = 442–443
| title = Impolite Numbers
| volume = 75
| doi = 10.2307/3618630
| jstor = 3618630}}.</ref>
Polite numbers have also been called '''staircase numbers''' because the [[Young diagram]]s representing graphically the [[Partition (number theory)|partition]]s of a polite number into consecutive integers (in the French style of drawing these diagrams) resemble [[staircase]]s.<ref>{{citation|title=Thinking Mathematically|first1=John|last1=Mason|first2=Leone|last2=Burton|first3=Kaye|last3=Stacey|publisher=Addison-Wesley|year=1982|isbn=978-0-201-10238-3}}.</ref><ref>{{citation|last1=Stacey|first1=K.|last2=Groves|first2=S.|year=1985|title=Strategies for Problem Solving|publisher=Latitude|location=Melbourne}}.</ref><ref>{{citation|last1=Stacey|first1=K.|last2=Scott|first2=N.|year=2000|contribution=Orientation to deep structure when trying examples: a key to successful problem solving|editor1-first=J.|editor1-last=Carillo|editor2-first=L. C.|editor2-last=Contreras|title=Resolucion de Problemas en los Albores del Siglo XXI: Una vision Internacional desde Multiples Perspectivas y Niveles Educativos|pages=119–147|publisher=Hergue|location=Huelva, Spain|url=http://staff.edfac.unimelb.edu.au/~kayecs/publications/2000/ScottStacey-OrientationTo.pdf}}.</ref> If all numbers in the sum are strictly greater than one, the numbers so formed are also called '''trapezoidal numbers''' because they represent patterns of points arranged in a [[trapezoid]].<ref>{{citation|doi=10.2307/2689901|title=Trapezoidal numbers|first1=Carlton|last1=Gamer|first2=David W.|last2=Roeder|first3=John J.|last3=Watkins|journal=Mathematics Magazine|volume=58|issue=2|year=1985|pages=108–110|jstor=2689901}}.</ref><ref>{{citation|title=Les nombres trapézoïdaux|last=Jean|first=Charles-É.|url=http://www.recreomath.qc.ca/art_trapezoidaux_n.htm|journal=Bulletin de l’AMQ|date=March 1991|pages=6–11|format=French}}.</ref><ref>{{citation|title=Discovering relationships and patterns by exploring trapezoidal numbers|first1=Paul W.|last1=Haggard|first2=Kelly L.|last2=Morales|journal=International Journal of Mathematical Education in Science and Technology|volume=24|issue=1|year=1993|pages=85–90|doi=10.1080/0020739930240111}}.</ref><ref>{{citation|title=The case of trapezoidal numbers|last=Feinberg-McBrian|first=Carol|journal=Mathematics Teacher|volume=89|issue=1|pages=16–24|year=1996}}.</ref><ref>{{citation|first=Jim|last=Smith|title=Trapezoidal numbers|journal=Mathematics in School|volume=5|year=1997|page=42}}.</ref><ref>{{citation|first=T.|last=Verhoeff|title=Rectangular and trapezoidal arrangements|url=http://www.emis.de/journals/JIS/trapzoid.html|journal=Journal of Integer Sequences|volume=2|year=1999|id=Article 99.1.6}}.</ref><ref name="JonesLord99">{{citation|title=Characterising non-trapezoidal numbers|first1=Chris|last1=Jones|first2=Nick|last2=Lord|journal=The Mathematical Gazette|volume=83|issue=497|year=1999|pages=262–263|doi=10.2307/3619053|jstor=3619053}}.</ref>
 
The problem of representing numbers as sums of consecutive integers and of counting the number of representations of this type has been studied by [[James Joseph Sylvester|Sylvester]],<ref name="Sylvester">{{citation|title=A constructive theory of partitions, arranged in three acts, an interact and an exodion|first=J. J.|author2=Franklin, F|last=Sylvester|authorlink=James Joseph Sylvester|journal=American Journal of Mathematics|volume=5|issue=1|year=1882|pages=251–330|doi=10.2307/2369545|jstor=2369545}}. In [http://www.archive.org/details/collectedmathem04sylvrich The collected mathematical papers of James Joseph Sylvester (December 1904)], H. F. Baker, ed. Sylvester defines the ''class'' of a partition into distinct integers as the number of blocks of consecutive integers in the partition, so in his notation a polite partition is of first class.</ref> Mason,<ref>{{citation|title=On the representations of a number as a sum of consecutive integers|first=T. E.|last=Mason|journal=Proceedings of the Indiana Academy of Science|year=1911|pages=273–274}}.</ref><ref name="Mason1912">{{citation|last=Mason|first=Thomas E.|title=On the representation of an integer as the sum of consecutive  integers|journal=American Mathematical Monthly|volume=19|year=1912|issue=3|pages=46–50|doi=10.2307/2972423|mr=1517654|jstor=2972423}}.</ref> [[William J. LeVeque|Leveque]],<ref>{{citation|title=On representations as a sum of consecutive integers|first=W. J.|last=Leveque|authorlink=William J. LeVeque|journal=Canadian Journal of Mathematics|volume=2|year=1950|pages=399–405|mr=0038368|doi=10.4153/CJM-1950-036-3}},</ref> and many other more recent authors.<ref name="Adams1993"/><ref name="Griggs1991"/><ref>{{citation|last=Pong|first=Wai Yan|title=Sums of consecutive integers|journal=College Math. J.|volume=38|year=2007|issue=2|pages=119–123|mr=2293915|arxiv=math/0701149}}.</ref><ref>{{citation|last1=Britt|first1=Michael J. C.|last2=Fradin|first2=Lillie|last3=Philips|first3=Kathy|last4=Feldman|first4=Dima|last5=Cooper|first5=Leon N.|title=On sums of consecutive integers|journal=Quart. Appl. Math.|volume=63|year=2005|issue=4|pages=791–792|mr=2187932}}.</ref><ref>{{citation|last=Frenzen|first=C. L.|title=Proof without words: sums of consecutive positive integers|journal=Math. Mag.|volume=70|year=1997|issue=4|page=294|mr=1573264|jstor=2690871}}.</ref><ref>{{citation|last=Guy|first=Robert|title=Sums of consecutive integers|journal=[[Fibonacci Quarterly]]|volume=20|year=1982|issue=1|pages=36–38}}.</ref><ref>{{citation|title=Sums of consecutive positive integers|first=Tom M.|last=Apostol|authorlink=Tom M. Apostol|journal=The Mathematical Gazette|volume=87|issue=508|year=2003|pages=98–101|jstor=3620570}}.</ref><ref>{{citation|last1=Prielipp|first1=Robert W.|last2=Kuenzi|first2=Norbert J.|title=Sums of consecutive positive integers|journal=Mathematics Teacher|volume=68|issue=1|pages=18–21|year=1975}}.</ref><ref>{{citation|last=Parker|first=John|title=Sums of consecutive integers|journal=Mathematics in School|volume=27|issue=2|pages=8–11|year=1998}}.</ref>
 
==Examples and characterization==
The first few polite numbers are
:3, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17, ... {{OEIS|id=A138591}}.
 
The impolite numbers are exactly the [[power of two|powers of two]].<ref name="Sylvester"/> It follows from the [[Lambek–Moser theorem]] that the ''n''th polite number is &fnof;(''n''&nbsp;+&nbsp;1), where
:<math>f(n)=n+\left\lfloor\log_2\left(n+\log_2 n\right)\right\rfloor.</math>
 
==Politeness==
The ''politeness'' of a positive number is defined as the number of ways it can be expressed as the sum of consecutive integers. For every ''x'', the politeness of ''x'' equals the number of [[odd number|odd]] [[divisor]]s of ''x'' that are greater than one.<ref name="Sylvester"/>
The politeness of the numbers 1, 2, 3, ... is
:0, 0, 1, 0, 1, 1, 1, 0, 2, 1, 1, 1, 1, 1, 3, 0, 1, 2, 1, 1, 3, ... {{OEIS|id=A069283}}.
For instance, the politeness of 9 is 2 because it has two odd divisors, 3 and itself, and two polite representations
:9 = 2 + 3 + 4 = 4 + 5;
the politeness of 15 is 3 because it has three odd divisors, 3, 5, and 15, and (as is familiar to [[cribbage]] players)<ref>{{citation|first1=Ronald|last1=Graham|author1-link=Ronald Graham|first3=Oren|last3=Patashnik|author3-link=Oren Patashnik|first2=Donald|last2=Knuth|author2-link=Donald Knuth|title=[[Concrete Mathematics]]|publisher=Addison-Wesley|page=65|contribution=Problem 2.30|isbn=0-201-14236-8|year=1988}}.</ref> three polite representations
:15 = 4 + 5 + 6 = 1 + 2 + 3 + 4 + 5 = 7 + 8.
An easy way of calculating the ''politeness'' of a positive number is that of decomposing the number into its [[prime factors]], taking the powers of all prime factors greater than 2, adding 1 to all of them, multiplying the numbers thus obtained with each other and subtracting 1. For instance 90 has politeness 5 because <math>90 = 2 \times 3^2 \times 5^1</math>; the powers of 3 and 5 are respectively 2 and 1, and applying this method (2+1)*(1+1)-1 = 5.
 
==Construction of polite representations from odd divisors==
To see the connection between odd divisors and polite representations, suppose a number ''x'' has the odd divisor ''y''&nbsp;&gt;&nbsp;1. Then ''y'' consecutive integers centered on ''x''/''y'' (so that their average value is ''x''/''y'') have ''x'' as their sum:
:<math>x=\sum_{i=\frac{x}{y} - \frac{y-1}{2}}^{\frac{x}{y} + \frac{y-1}{2}}i.</math>
Some of the terms in this sum may be zero or negative. However, if a term is zero it can be omitted and any negative terms may be used to cancel positive ones, leading to a polite representation for ''x''. (The requirement that ''y''&nbsp;&gt;&nbsp;1 corresponds to the requirement that a polite representation have more than one term; applying the same construction for ''y''&nbsp;=&nbsp;1 would just lead to the trivial one-term representation ''x''&nbsp;=&nbsp;''x''.)
For instance, the polite number ''x''&nbsp;=&nbsp;14 has a single nontrivial odd divisor, 7. It is therefore the sum of 7 consecutive numbers centered at 14/7&nbsp;=&nbsp;2:
:14 = (2 &minus; 3) + (2 &minus; 2) + (2 &minus; 1) + 2 + (2 + 1) + (2 + 2) + (2 + 3).
The first term, &minus;1, cancels a later +1, and the second term, zero, can be omitted, leading to the polite representation
:14 = 2 + (2 + 1) + (2 + 2) + (2 + 3) = 2 + 3 + 4 + 5.
 
Conversely, every polite representation of ''x'' can be formed from this construction. If a representation has an odd number of terms, ''x''/''y'' is the middle term, while if it has an even number of terms and its minimum value is ''m'' it may be extended in a unique way to a longer sequence with the same sum and an odd number of terms, by including the 2''m''&nbsp;&minus;&nbsp;1 numbers &minus;(''m''&nbsp;&minus;&nbsp;1), &minus;(''m''&nbsp;&minus;&nbsp;2), ..., &minus;1, 0, 1, ..., &minus;(''m''&nbsp;&minus;&nbsp;2), &minus;(''m''&nbsp;&minus;&nbsp;1).
After this extension, again, ''x''/''y'' is the middle term. By this construction, the polite representations of a number and its odd divisors greater than one may be placed into a [[bijection|one-to-one correspondence]], giving a [[bijective proof]] of the characterization of polite numbers and politeness.<ref name="Sylvester"/><ref>{{citation|title=The inquisitive problem solver|publisher=Mathematical Association of America|year=2002|authorlink=Paul Vaderlind|first1=Paul|last1=Vaderlind|first2=Richard K.|last2=Guy|author2-link=Richard K. Guy|first3=Loren C.|last3=Larson|isbn=978-0-88385-806-6|pages=205–206}}.</ref> More generally, the same idea gives a two-to-one correspondence between, on the one hand, representations as a sum of consecutive integers (allowing zero, negative numbers, and single-term representations) and on the other hand odd divisors (including 1).<ref name="Mason1912"/>
 
Another generalization of this result states that, for any ''n'', the number of partitions of ''n'' into odd numbers having ''k'' distinct values equals the number of partitions of ''n'' into distinct numbers having ''k'' maximal runs of consecutive numbers.<ref name="Sylvester"/><ref>{{citation|title=On generalizations of Euler's partition theorem|first=G. E.|last=Andrews|journal=Michigan Mathematical Journal|volume=13|year=1966|pages=491–498|doi=10.1307/mmj/1028999609|mr=0202617|issue=4}}.</ref><ref>{{citation|title=On a partition theorem of Sylvester|first1=V.|last1=Ramamani|first2=K.|last2=Venkatachaliengar|volume=19|issue=2|year=1972|pages=137–140|doi=10.1307/mmj/1029000844|journal=The Michigan Mathematical Journal|mr=0304323}}.</ref>  
Here a run is one or more consecutive values such that the next larger and the next smaller consecutive values are not part of the partition; for instance the partition 10&nbsp;=&nbsp;1&nbsp;+&nbsp;4&nbsp;+&nbsp;5 has two runs, 1 and 4&nbsp;+&nbsp;5.
A polite representation has a single run, and a partition with one value ''d'' is equivalent to a factorization of ''n'' as the product ''d''&times;(''n''/''d''), so the special case ''k''&nbsp;=&nbsp;1 of this result states again the equivalence between polite representations and odd factors (including in this case the trivial representation ''n''&nbsp;=&nbsp;''n'' and the trivial odd factor&nbsp;1).
 
==Trapezoidal numbers==
If a polite representation starts with 1, the number so represented is a [[triangular number]]
: <math> T_n = \frac{n(n+1)}{2} = 1 + 2 + \cdots + n. \,\! </math>
Otherwise, it is the difference of two triangular numbers:
: <math> i + (i + 1) + (i + 2) + \cdots + j = T_j - T_{i-1}. \,\! </math>
In the latter case, it is called a trapezoidal number. That is, a trapezoidal number is a polite number that has a polite representation in which all terms are strictly greater than one. The only polite numbers that may be non-trapezoidal are the triangular numbers with only one nontrivial odd divisor, because for those numbers, according to the bijection described earlier, the odd divisor corresponds to the triangular representation and there can be no other polite representations. Thus, polite non-trapezoidal numbers must have the form of a power of two multiplied by a prime number. As Jones and Lord observe,<ref name="JonesLord99"/> there are exactly two types of triangular numbers with this form:
#the even [[perfect number]]s 2<sup>''n''&nbsp;&minus;&nbsp;1</sup>(2<sup>''n''</sup>&nbsp;&minus;&nbsp;1) formed by the product of a [[Mersenne prime]] 2<sup>''n''</sup>&nbsp;&minus;&nbsp;1 with half the nearest [[power of two]], and
#the products 2<sup>''n''&nbsp;&minus;&nbsp;1</sup>(2<sup>''n''</sup>&nbsp;+&nbsp;1) of a [[Fermat prime]] 2<sup>''n''</sup>&nbsp;+&nbsp;1 with half the nearest power of two.
{{OEIS|id=A068195}}. For instance, the perfect number 28&nbsp;=&nbsp;2<sup>3&nbsp;&minus;&nbsp;1</sup>(2<sup>3</sup>&nbsp;&minus;&nbsp;1) and the number 136&nbsp;=&nbsp;2<sup>4&nbsp;&minus;&nbsp;1</sup>(2<sup>4</sup>&nbsp;+&nbsp;1) are both polite triangular numbers that are not trapezoidal. It is believed that there are finitely many Fermat primes (only five of which — 3, 5, 17, 257, and 65,537 — have been discovered), but infinitely many Mersenne primes, in which case there are also infinitely many polite non-trapezoidal numbers.
 
==References==
{{reflist|2}}
 
==External links==
*{{Planetmath reference|id=10725|title=Polite number}}
*{{citation
| date = December 2002
| publisher = NRICH, University of Cambridge
| title = Polite Numbers
| url = http://nrich.maths.org/public/viewer.php?obj_id=2074}}
*[http://www.mcs.surrey.ac.uk/Personal/R.Knott/runsums/index.html An Introduction to Runsums], R. Knott.
*[http://www.intellectualism.org/questions/QOTD/oct03/20031002.php Is there any pattern to the set of trapezoidal numbers?] Intellectualism.org question of the day, October 2, 2003. With a diagram showing trapezoidal numbers color-coded by the number of terms in their expansions.
{{Classes of natural numbers}}
[[Category:Additive number theory]]
[[Category:Figurate numbers]]
[[Category:Integer sequences]]
[[Category:Quadrilaterals]]
[[Category:Recreational mathematics]]

Latest revision as of 04:51, 9 January 2015

Marvella is what you can call her but it's not the most feminine title out there. Hiring is her day job now but she's usually needed her own company. Playing baseball is the hobby he will never quit performing. Years in the past we moved to North Dakota.

Here is my website; xrambo.com