Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail NNTP-Posting-Date: Fri, 27 Jan 2012 16:06:24 -0600 Message-ID: <4F231FE7.3B63@mindspring.com> Date: Fri, 27 Jan 2012 17:06:31 -0500 From: pete Reply-To: pfiland@mindspring.com Organization: PF X-Mailer: Mozilla 3.04Gold (WinNT; I) MIME-Version: 1.0 Newsgroups: comp.lang.c Subject: Re: [Hardest Maths Statement Puzzle] Toughest Math Statement Question References: <4F090789.D54@mindspring.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 33 X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 4.154.216.100 X-Trace: sv3-aFh0xk36RyFVEFFwjRtXPEKknlHCnC6eP92e8C7dL4ndLsa6nwDsSxsofaAigmfOxDH6MtYSy2x9kDf!ho57QC/ebygeGvFADMcIgSvQFGMfrzRp6GkVLwCis7YGSLHc8x67o+xjkaN2STV0gcggNoBnJes8!DR5V+0q3B8Q= X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2053 Xref: x330-a1.tempe.blueboxinc.net comp.lang.c:16319 Tim Rentsch wrote: > > pete writes: > > > divya bisht wrote: > >> > >> Toughest Math Statement Question > >> (Source : http://hardest-puzzle.blogspot.com/2011/12/toughest-math-statement-question.html > >> ) > >> > >> I am thinking of a 6-digit number. The sum of the digits is 43. > >> > >> And only two of the following three statements about the number are > >> true: > >> > >> (1) it's a square number, > >> (2) it's a cube number, and > >> (3) the number is under 500000. > > > > [snip program -- 114 lines of code, 24 lines of comments] > > Seems like a rather long program for the problem... how > about this instead? > > #include > > int digit_sum_of_equals( unsigned number, unsigned total ); The programs would have been more portable if we both had used long unsigned instead of unsigned. -- pete