Survey
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
Consecutive Integer Squares 11October2016 StephenMorris,Newbury,Berkshire,UK [email protected] FromStanWagon’sProblemoftheWeek1229 ProblemStatement: For which positive integers n is there a sum of n consecutive integers that is a perfect square? Solution: Anaturalapproachistocalculatesuchasumasanexplicitformula.Howeverweprefertoreframe theproblemasoneaboutrectanglesandintegertripleswhichavoidstheneedformuchalgebra. Wewilluseonenoteofgeometryandsomesimplelogicasourmaintools. ThecompletegeneralsolutionisgivenbelowasTheorem1.Theproofwillcomesimplyfromour approachtowardstheend. Theorem1:Anygivenpositiveintegernfactorisesuniquelyas2fg2hwhereg,hareoddandhis squarefree.Thegeneralsolutionforsequencesofconsecutiveintegersoflengthnthatsumtoa perfectsquareisgivenby: hr2–(n-1)/2..hr2+(n-1)/2 (hr2–(n-1))/2..(hr2+(n-1))/2 Non-existent foranyintegerr, whenf=0 foranyoddintegerr, whenfodd whenf>0even Considerarectanglewithwidthintegera,andheightintegerb>a.Therectangleissuchthatitcan besplitintoidenticalhalvesusingasteppedlinecomposedofedgesoftheunitsquares. Thecentreoftherectangleisacentreofrotationforthesteppedline,andsoisinthemiddleofan edgeofaunitsquare.Ifthisisahorizontaledge(asshown)thenaisoddandbeven.Ifitisvertical thenaisevenandbodd.Socertainlyaandbhavedifferentparity. Eachhalfrepresentsasequenceofconsecutivenumbers.Iftheareais2c2thenitisoursolutionto theoriginalproblemforn=a. Lessobviousisthatitisalsoasolutionforn=b,ifweallowthesequencetocontainzeroand negativeintegers.Weillustratethiswithanexample: Inthesecondcase,ontherightofthediagram,theareaabovetherectangleisequaltothearea below.Sincetheformercontributesapositiveamounttothesumandthelattercontributesa negativeamounttheycancelout.Sothesumofthesequenceishalfoftheareaoftherectangle. Anysequenceofconsecutiveintegerswillgeneratesucharectangle. Withthisobservationwemayreframetheproblemasfollows. Wesaythatatripleofpositiveintegers,(a,b,c),isasolutionifitsatisfiesthefollowingconditions: 1. aisodd 2. biseven 3. ab=2c2 Notethatwehaveremovedtheconditionthatb>a. Weusethetermsolutionsinceitrepresentssolutionstotheoriginalproblemforn=aandn=b. Theexampleaboveisthesolution(3,6,3)andsorepresentsasolutiontotheoriginalproblemfor n=3andn=6. OurnextresultsareputintheformofaLemma. Lemma1: i. ii. iii. iv. v. (a,2a,a)isasolutionforanyoddpositiveintegera. If(a,b,c)isasolutionthen a. (a,r2b,rc)isasolutionforanyintegerr, b. (r2a,b,rc)isasolutionforanyoddintegerr. Inanysolutionbisdivisibleby2anoddnumberoftimes. Thereisasolutionfornpreciselywheneithernisoddornisdivisibleby2anoddnumberof times. Ifthereisasolutionfornthenthereisasolutionwheretheconsecutiveintegersarepositive. ProofofLemma1: i.andii.aresimpletocheckagainsttheconditionsforasolution. iii.followsfromcondition3,thatab=2c2.WeconsiderthattheRHSisdivisibleby2anoddnumber oftimesandthataisodd. Foriv:Ifnisoddweusei.Ifniseventhenweusei.andii.a.withrapowerof2.Thesituation wherenisdivisibleby2anevennumberoftimesisexcludedbyiii. Forv.weuseii.togetarectanglewithntheshortestside. Lemma1.ivsolvesthestatedproblem.Lemma1.vshowsthatweonlyneedconsiderpositive integers. Theabovedemonstrateswhenasolutionexistsforn.Wewishtocalculatethesequences generatedby(a,b,c).Therearetwosuchsequences,forn=aandn=b. Letsbethefirstnumberinasequenceandtbethelastnumberinthesequencesothatthe sequenceiss..t. Firsttakethatcasewheren=a.Wehavethefollowingequationstosolve. t–s=a–1 sincethelengthofthesequenceisn=a t+s=b bytheconstructionoftherectangle fromwhich t=(b+a–1)/2 s=(b–a+1)/2 Intheothercasewheren=bthenwemustswitchthevaluesaandbtoget t=(a+b–1)/2 s=(a–b+1)/2 Notethattisthesameinbothcases.Thedifferenceinsisexplainedbyobservingthatweadd equivalentnegativeandpositiveintegers,pluszero,tothestartofthesequence. Applyingthistoourexample(3,6,3)wegett=(6+3-1)/2=4.Forn=3wegets=(6-3+1)/2=2.For n=6wegets=(3-6+1)/2=-1.Sothesequencesare: 2+3+4=9 -1+0+1+2+3+4=9 AWorkedExample Toshowthatthisisaconstructivesolutionletusconsideraworkedexample. Question:Canwefindasequenceof40consecutivepositiveintegerssuchthatthesumisaperfect square? Answer: 40is235,sowestartbyusingLemma1.itoget(5,10,5). NextweuseLemma1.ii.atoget(5,40,10). Aswewantapositivesolutionwemusthave40thesmallestofaandb,soweuseLemma1.ii.bto get(45,40,30). Usingourformulaeforsandtwefindthesequenceis(45-40+1)/2..(45+40-1)/2whichis3..42. Weshouldcheckthatthesumis302. !" !" 𝑖= !!! = ! 𝑖 𝑖 − !!! !!! 42 42 + 1 2 2+1 − 2 2 = 903 − 3 = 30! TheGeneralSolution Anypositiveintegernwithasolutioncanbefactoriseduniquelyasn=2fg2hwherefiszeroorodd,g andhareoddandhissquare-free. Firstweconsiderthecasewherenisodd,whichoccurswhenf=0andson=g2h. Firstwefindthegeneralsolutionintermsoftriples.Atriplerepresentingasolutionmusthavea=n =g2h,sincenisodd.Thenbmustbedivisibleby2htosatisfyab=2c2.Thatgivesthegeneral solution(g2h,2r2h,rgh)foranyintegerr. Thesequenceisgivenby s=(b–a+1)/2=(2r2h-g2h+1)/2=hr2–(n-1)/2 t=(b+a-1)/2=(2r2h+g2h-1)/2=hr2+(n-1)/2 Sothesequenceis hr2–(n-1)/2..hr2+(n-1)/2 Intheothercaseniseven,whichoccurswhenf>0.FromtheLemma1weknowthatfmustbeodd. Againwefindthegeneralsolutionintermsoftriples.Atriplerepresentingasolutionmusthaveb= n=2fg2h,sinceniseven.Thenamustbedivisiblebyhtosatisfyab=2c2.Wehavethegeneral solution(r2h,2fg2h,2(f-1)/2rgh)foranyoddintegerr. Thesequenceisgivenby s=(a-b+1)/2=(r2h–2fg2h+1)/2=(hr2–(n-1))/2 t=(a+b-1)/2=(r2h+2fg2h-1)/2=(hr2+(n-1))/2 Sothesequenceis (hr2–(n-1))/2..(hr2+(n-1))/2 ThisprovesTheorem1whichwerestatehereforconvenience. Theorem1:Anygivenpositiveintegernfactorisesuniquelyas2fg2hwhereg,hareoddandhis squarefree.Thegeneralsolutionforsequencesofconsecutiveintegersoflengthnthatsumtoa perfectsquareisgivenby: hr2–(n-1)/2..hr2+(n-1)/2 (hr2–(n-1))/2..(hr2+(n-1))/2 Non-existent foranyintegerr, whenf=0 foranyoddintegerr, whenfodd whenf>0even ATableofSolutionsforsmalln UsingtheformulaeinTheorem1wecanwriteatableofpossiblesolutionsforeachn. n 1 2 3 4 f 0 1 0 2 g 1 1 1 1 h 1 1 3 1 From r2 (r2-1)/2 3r2-1 To r 2 (r2+1)/2 3r2+1 SqrtSum r r 3r 5 6 7 8 9 10 11 12 0 1 0 3 0 1 0 2 1 1 1 1 3 1 1 1 5 3 7 1 1 5 11 3 5r2-2 (3r2-5)/2 7r2-3 (r2-7)/2 r2-4 (5r2-7)/2 11r2-5 5r2+2 (3r2+5)/2 7r2+3 (r2+7)/2 r2+4 (5r2+7)/2 11r2+5 5r 3r 7r 2r 3r 5r 11r 13 14 15 16 0 1 0 4 1 1 1 1 13 7 15 1 13r2-6 (7r2-13)/2 15r2-7 13r2+6 (7r2+13)/2 15r2+7 13r 7r 15r 17 18 0 1 1 3 17 1 17r2-8 (r2-17)/2 17r2+8 (r2+17)/2 17r 3r ris… Odd None Exist Odd Odd Odd None Exist Odd None Exist Odd 19 20 0 2 1 1 19 5 19r2-9 19r2+9 21 22 0 1 1 1 21 11 21r2+10 21r (11r2+21)/2 11r 23 24 25 26 0 3 0 1 1 1 5 1 23 3 1 13 23r2+11 (3r2+23)/2 r2+12 (13r2+25)/2 23r 6r 5r 13r Odd Odd 27 28 0 2 3 1 3 7 21r2-10 (11r221)/2 23r2-11 (3r2-23)/2 r2-12 (13r225)/2 3r2-13 None Exist Odd 3r2+13 9r 29 30 0 1 1 1 29 15 29r2+14 29r 2 (15r +29)/2 15r 31 32 33 34 0 5 0 1 1 1 1 1 31 1 33 17 29r2-14 (15r229)/2 31r2-15 (r2-31)/2 33r2-16 (17r233)/2 None Exist Odd 31r2+15 (r2+31)/2 33r2+16 (17r2+33)/2 Odd Odd 19r 31r 4r 33r 17r