Page 1 of 1

Problem 040

Posted: Thu Jul 16, 2009 6:28 am
by matt271
i am new here so i dunno if this is ok to do...

anyways i think i have the best solution to Problem 40
An irrational decimal fraction is created by concatenating the positive integers:

0.123456789101112131415161718192021...

It can be seen that the 12^(th) digit of the fractional part is 1.

If d_(n) represents the n^(th) digit of the fractional part, find the value of the following expression.

d_(1) × d_(10) × d_(100) × d_(1000) × d_(10000) × d_(100000) × d_(1000000)
my solution in c99 is: (i hope this hides for non-spoilers)

Code: Select all

edit: uhhhh pm me for the code
the c code itself is not that impressive, but the math i used i think is. i have (what i like to think is) a brilliant method to derive the numbers u see in array a[] :D

does anybody care? anybodys thoughts? i wanted to post this on the thing for it, but its locked for archive.

Re: i think i have the best solution to Problem 40

Posted: Thu Jul 16, 2009 1:25 pm
by elendiastarman
You should edit your post to get rid of that, because hide tag or not, we never want to give easy solutions to others; the spirit of Project Euler is that solvers work it out themselves.
Anyway, I suppose you could pm one of the admins and they might unlock it for a moment, depending on their feelings about the noteworthiness of your new solution. Hope this helps...

Re: i think i have the best solution to Problem 40

Posted: Thu Jul 16, 2009 7:02 pm
by matt271
my bad

Re: i think i have the best solution to Problem 40

Posted: Fri Jul 17, 2009 8:28 pm
by hk
Browsing through the forum I see several solutions that are O(log(n)).
If you think you can do better you can PM me. (Please with explanation, and not only code).
If it is as brilliant as you suggest it is, I could open the forum temporarily.

Re: Problem 040

Posted: Fri Jul 17, 2009 10:49 pm
by Georg
matt271 wrote:anyways i think i have the best solution to Problem 40
[...]
i wanted to post this on the thing for it, but its locked for archive.
Have you read all 187 posts in the thread for problem 40? I don't think so.
Read euler's posts to understand why some threads are locked.

Problem 40

Posted: Wed Jun 23, 2010 11:09 pm
by karenhunt6116
after .....919294949596979899 what is next?

karen

Re: Problem 40

Posted: Wed Jun 23, 2010 11:30 pm
by stijn263
after 919294949596979899 i'd guess 919294949596979900.

But I think you mean:
91 92 94 94 95 96 97 98 99

And made a typo. In that case, it is followed by 100101102...

Re: Problem 040

Posted: Sat Aug 28, 2010 11:19 am
by allenfantasy
Actually i've done this by hand...some calculations lead to success.

Re: Problem 040

Posted: Mon Jun 18, 2012 12:21 am
by tijko
[link]Problem 040[/link]

I feel this should be obvious and since I'm going to be one of only people to be unsure of it but, is this some kind of permutation of '0.123456789'?

Or is it a pattern of '101112131415161718192021222324......' all the way through 1-9(and 0) then repeat?

Re: Problem 040

Posted: Mon Jun 18, 2012 12:37 am
by TripleM
I'm not quite sure what you're asking, but the first line of the problem says the sequence is formed by concatenating the positive integers - positive integers don't stop at 9 or 99, they continue forever. So there's no repeating or permutations involved.

Re: Problem 040

Posted: Mon Jun 18, 2012 1:03 am
by tijko
TripleM thanks for such a quick response and that really helped. What I was unclear about, was that I wasn't making a distinction between, say '11' and a pattern sequence '1,1' (in my mind).

I knew that irrational numbers do not repeat, so the direction I started to think was that there was suppose to be more and more of '111's (or any 1-9) in front of the each number (1-9) after each cycle.

The other thing I would revert to thinking was that it was a pattern cycle and that wouldn't make it irrational, so thats where I was just grasping with the permutation thing.