Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| Path | csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!.POSTED!not-for-mail |
|---|---|
| From | Willem <willem@toad.stack.nl> |
| Newsgroups | comp.lang.c |
| Subject | Re: [Hardest Maths Statement Puzzle] Toughest Math Statement Question |
| Date | Thu, 8 Mar 2012 22:26:51 +0000 (UTC) |
| Organization | Stack Usenet News Service |
| Lines | 48 |
| Message-ID | <slrnjlichb.1bqb.willem@toad.stack.nl> (permalink) |
| References | <d2f643df-1028-4906-808d-faa935f94fa0@f8g2000prm.googlegroups.com> <4F090789.D54@mindspring.com> <kfnaa5a2v1l.fsf@x-alumni2.alumni.caltech.edu> <4F233391.5FC@mindspring.com> <8610849.1416.1328019561212.JavaMail.geo-discussion-forums@prnc5> |
| NNTP-Posting-Host | toad.stack.nl |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Transfer-Encoding | 7bit |
| X-Trace | mud.stack.nl 1331245611 13187 131.155.140.135 (8 Mar 2012 22:26:51 GMT) |
| X-Complaints-To | abuse@stack.nl |
| NNTP-Posting-Date | Thu, 8 Mar 2012 22:26:51 +0000 (UTC) |
| User-Agent | slrn/0.9.9p1 (FreeBSD) |
| Xref | csiph.com comp.lang.c:18363 |
Show key headers only | View raw
88888 Dihedral wrote:
)> > > 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.
) Looking for an integer number rasied to a power of 6 that fits all
)
) conditions in the range should be easy even without writing a program.
No because only two of the three conditions are true. One is false.
If contition 3 were false, then the number would be both a square and
a cube, and it would be above 500000. There is exactly one sixth power
between 500000 and 999999, which is 531441, and that does not sum to 43.
So we're looking for a number that's either a cube or a square (but not
both) between 100000 and 499999.
As a matter of fact, the powers of 6 below 500000 don't sum to 43 either,
so the 'but not both' check is optional, and we can simple scan all squares
and all cubes for the one that has a digit sum of 43:
for (int s = 317; s < 708; s++)
if (digit_sum(s*s) == 43)
printf("%d\n", s*s);
for (int c = 47; c < 80; c++)
if (digit_sum(c*c*c) == 43)
printf("%d\n", c*c*c);
(The function digit_sum should be self-evident.)
SaSW, Willem
--
Disclaimer: I am in no way responsible for any of the statements
made in the above text. For all I know I might be
drugged or something..
No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [Hardest Maths Statement Puzzle] Toughest Math Statement Question pete <pfiland@mindspring.com> - 2012-01-07 22:03 -0500
Re: [Hardest Maths Statement Puzzle] Toughest Math Statement Question Tim Rentsch <txr@alumni.caltech.edu> - 2012-01-26 10:11 -0800
Re: [Hardest Maths Statement Puzzle] Toughest Math Statement Question pete <pfiland@mindspring.com> - 2012-01-27 17:06 -0500
Re: [Hardest Maths Statement Puzzle] Toughest Math Statement Question pete <pfiland@mindspring.com> - 2012-01-27 18:30 -0500
Re: [Hardest Maths Statement Puzzle] Toughest Math Statement Question 88888 Dihedral <dihedral88888@googlemail.com> - 2012-01-31 06:19 -0800
Re: [Hardest Maths Statement Puzzle] Toughest Math Statement Question Willem <willem@toad.stack.nl> - 2012-03-08 22:26 +0000
Re: [Hardest Maths Statement Puzzle] Toughest Math Statement Question Tim Rentsch <txr@alumni.caltech.edu> - 2012-01-31 22:28 -0800
Re: [Hardest Maths Statement Puzzle] Toughest Math Statement Question pete <pfiland@mindspring.com> - 2012-02-01 18:47 -0500
Re: [Hardest Maths Statement Puzzle] Toughest Math Statement Question Tim Rentsch <txr@alumni.caltech.edu> - 2012-03-08 12:24 -0800
csiph-web