Problem 043
Forum rules
As your posts will be visible to the general public you are requested to be thoughtful in not posting anything that might explicitly give away how to solve a particular problem.
This forum is NOT meant to discuss solution methods for a problem.
See also the topics:
Don't post any spoilers
Comments, questions and clarifications about PE problems.
As your posts will be visible to the general public you are requested to be thoughtful in not posting anything that might explicitly give away how to solve a particular problem.
This forum is NOT meant to discuss solution methods for a problem.
In particular don't post any code fragments or results.
Don't start begging others to give partial answers to problems
Don't ask for hints how to solve a problem
Don't start a new topic for a problem if there already exists one
Don't start begging others to give partial answers to problems
Don't ask for hints how to solve a problem
Don't start a new topic for a problem if there already exists one
See also the topics:
Don't post any spoilers
Comments, questions and clarifications about PE problems.
-
helstreak
- Posts: 19
- Joined: Mon Jan 26, 2009 5:00 am
Problem 043
can the divisible numbers start with d1...something like:
d1d2d3 = someNumber is divisible by 2
d2d3d4 = someNumber is divisible by 3
d3d4d5 = ...
thanks for your help
d1d2d3 = someNumber is divisible by 2
d2d3d4 = someNumber is divisible by 3
d3d4d5 = ...
thanks for your help
- DNS
- Posts: 30
- Joined: Thu Oct 16, 2008 9:32 am
- Location: Ukraine, Nikolaev
Re: Problem 43
May be it possible, but for this problem numbers start with 2nd digit.
2 x 2 = 4 = true
-
ccarr
- Posts: 3
- Joined: Thu Feb 25, 2010 1:19 am
Problem 043
I just recently started learning C# as my first programming language and solved this problem using what I think is an efficient algorithm (156 ms). Could I PM or email my code to someone for a critique?
- rayfil
- Administrator
- Posts: 1412
- Joined: Sun Mar 26, 2006 5:30 am
- Location: Quebec, Canada
- Contact:
Re: Problem 043
Efficiency is a very relative notion.I think is an efficient algorithm (156 ms)
You do admit yourself that you are a beginner. Imagine someone taking up art painting classes and completing their first canvas within a month. And then watching someone on TV complete a beautiful scenery within 30 minutes. That should not discourage the pupil from trying to improve; some day he could perform as well with continued effort.
I have no knowledge of C# but my algo runs in 0.02 ms (almost 10,000 times faster than yours). Trying to optimize your algo may not gain you much. Based on what you may have learned while developing your current algo, you may be able to devise a modified algo (or a completely different one) which should be much more efficient and run 10-100 times faster. That can be the fun part of programming.
When you assume something, you risk being wrong half the time.
-
ccarr
- Posts: 3
- Joined: Thu Feb 25, 2010 1:19 am
Re: Problem 043
Thanks for your response, rayfil; I understand exactly what you mean. I know I have a long way to go before I know even half the ins-and-outs of good programming, but there's no substitute for the guidance of an experienced practitioner along the way. While it'll no doubt be a very long time before I can paint a landscape in 30 minutes, it won't hurt to know which brushes to bring to the easel! I guess what I meant by "efficient" was just that I didn't have any superfluous steps according to the particular approach I took, even if that approach isn't necessarily the fastest. Out of curiosity, what language(s) do you use?
-
quilan
- Posts: 182
- Joined: Fri Aug 03, 2007 11:08 pm
- rayfil
- Administrator
- Posts: 1412
- Joined: Sun Mar 26, 2006 5:30 am
- Location: Quebec, Canada
- Contact:
Re: Problem 043
As quilan mentioned, I do use assembly. However, in this context, other good compiled languages (with a decent compiler) using an algo similar to what I used should be able to provide an answer in 0.1 ms or less on a relatively recent computer (mine is a 2-year old 1.86GHz CoreDuo).
When you assume something, you risk being wrong half the time.
-
AArmada
- Posts: 3
- Joined: Sun Apr 24, 2011 9:13 pm
Re: Problem 043
How many numbers are there that satisfy the conditions? Im getting 24, but my sum is wrong.
- jaap
- Posts: 588
- Joined: Tue Mar 25, 2008 3:57 pm
- Contact:
Re: Problem 043
There are much fewer than that so many of your numbers cannot satisfy all the conditions.AArmada wrote:How many numbers are there that satisfy the conditions? Im getting 24, but my sum is wrong.
-
AArmada
- Posts: 3
- Joined: Sun Apr 24, 2011 9:13 pm
Re: Problem 043
Solved it, thanks for your help.jaap wrote:There are much fewer than that so many of your numbers cannot satisfy all the conditions.
-
smjg
- Posts: 1
- Joined: Sat Jun 11, 2011 1:35 am
Re: Problem 043
Just to clarify, am I right in making out that
- the property to be tested is exactly d2d3d4 divisible by 2, d3d4d5 divisible by 3, etc. as opposed to any other permutation?
- pandigital numbers in which the 0 occurs at the beginning (109 digit) still count?
- rayfil
- Administrator
- Posts: 1412
- Joined: Sun Mar 26, 2006 5:30 am
- Location: Quebec, Canada
- Contact:
Re: Problem 043
Yes•the property to be tested is exactly d2d3d4 divisible by 2, d3d4d5 divisible by 3, etc. as opposed to any other permutation?
No•pandigital numbers in which the 0 occurs at the beginning (109 digit) still count?
When you assume something, you risk being wrong half the time.

