Problem 093

A place to air possible concerns or difficulties in understanding ProjectEuler problems. This forum is not meant to publish solutions. This forum is NOT meant to discuss solution methods or giving hints how a problem can be solved.
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.

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


See also the topics:
Don't post any spoilers
Comments, questions and clarifications about PE problems.
kosiu_drumev
Posts: 6
Joined: Wed Jun 02, 2010 10:43 pm

Re: Problem 093

Post by kosiu_drumev »

Maybe it's a stupid or irrelevant question but anyway :)
Is ZERO a digit in the context of this problem?
Image
Last edited by kosiu_drumev on Sat Jul 09, 2011 10:00 pm, edited 1 time in total.
User avatar
jaap
Posts: 588
Joined: Tue Mar 25, 2008 3:57 pm
Contact:

Re: Problem 093

Post by jaap »

kosiu_drumev wrote:Is ZERO a digit in the context of this problem?
Yes it is, but since you're not allowed to concatenate digits, it isn't of much use.
thundre
Posts: 356
Joined: Sun Mar 27, 2011 10:01 am

Re: Problem 93

Post by thundre »

bobfin wrote: My method correctly finds that the digit set {1,2,3,4} yields a run of consecutive numbers 1 .. 28.
Mine did too, even when I forgot to include division as a valid operation. :)
Image
dconrad
Posts: 13
Joined: Mon Mar 14, 2011 12:45 pm

Re: Problem 093

Post by dconrad »

When I first read the problem, I misread two parts of it. I didn't catch that only positive integers were allowed as results, and I didn't catch that the series of consecutive integers had to be from 1 .. n. If you allow negative results and look for the longest consecutive series of integers regardless of starting value, then there is a better solution.

There is a set of four digits that produce 80 consecutive integers, from -36 .. 43. Can you find them?

My Java program takes around 1 second (for Problem 093 or this extended problem); somewhat over if I allow 0 as a digit, a little under if I don't.
User avatar
Francky
Posts: 90
Joined: Sat May 07, 2011 3:49 pm
Location: South of France

Re: Problem 093

Post by Francky »

I got 780ms in Python3 (interpreted), so you could do better in Java, I think

EDIT : 560ms, and I'm not proud of this algo.
Last edited by Francky on Mon Jun 20, 2011 7:49 pm, edited 1 time in total.
ImageEntia non sunt multiplicanda praeter necessitatem
Hibernatus34
Posts: 31
Joined: Mon May 16, 2011 7:03 am

Re: Problem 093

Post by Hibernatus34 »

780 ms sounds a bit long, i got 10 ms in C++ on an i5 2400 (from 3.1 to 3.4 GHz), and judging by the horrible code i think it was my first try and i never tried to optimize it.
Maybe you should try Psyco in order to get times that are closer to Java/C#/C++ times.

I bet one can achieve less than 1 ms on this problem :) Maybe with a little low-level optimization, or with another super-smart algorithm.
Image Joined PE in May 2011
Achab
Posts: 3
Joined: Thu Sep 08, 2011 12:59 pm

Re: Problem 093

Post by Achab »

Hi,

My answer to this problem is wrong, but I don't find the bug in my algorithm. I've found 4 digits which give 65 consecutive integers from 1 to 65. I suppose the exact answer give a longer sequence ?
thundre
Posts: 356
Joined: Sun Mar 27, 2011 10:01 am

Re: Problem 093

Post by thundre »

Achab wrote:My answer to this problem is wrong, but I don't find the bug in my algorithm. I've found 4 digits which give 65 consecutive integers from 1 to 65. I suppose the exact answer give a longer sequence ?
65 is too long. The correct answer yields a shorter sequence.
Image
Achab
Posts: 3
Joined: Thu Sep 08, 2011 12:59 pm

Re: Problem 093

Post by Achab »

I may be wrong but i got a set of 4 digits, i can give the details if needed, which yields a sequence of 65 integers (from 1 to 65).
User avatar
rayfil
Administrator
Posts: 1412
Joined: Sun Mar 26, 2006 5:30 am
Location: Quebec, Canada
Contact:

Re: Problem 093

Post by rayfil »

Send me a PM with your results and I will check them out.
When you assume something, you risk being wrong half the time.
Achab
Posts: 3
Joined: Thu Sep 08, 2011 12:59 pm

Re: Problem 093

Post by Achab »

Hi,
It won't be necessary, euler sent me a message detailing my mistake.
I actually used some digit 0 or 1 time instead of exactly 1 time.
regards
amidar1
Posts: 8
Joined: Tue Dec 20, 2011 12:37 am

Re: Problem 093

Post by amidar1 »

I'm getting a tie. :(

My algorithm gives results that match all the data that has been posted in this thread so far, but I have two different sets that produce the same longest string of accessible numbers. (I'm not sure whether it's appropriate to post how long that string is.)
Did anyone else hit that problem and / or have an idea what I might be missing?
MithrilTuxedo
Posts: 1
Joined: Thu Jan 17, 2013 9:34 pm

Re: Problem 093

Post by MithrilTuxedo »

I wasn't mentally parsing the term "digit" correctly. I'd conflated it with the broader term "integer".

I discovered, in significantly more time than it took to find the actual answer, that there are longer runs possible beyond the scope of the solution set. :oops:
edmurray
Posts: 1
Joined: Fri Sep 12, 2014 8:09 pm

Re: Problem 093

Post by edmurray »

MithrilTuxedo wrote:I wasn't mentally parsing the term "digit" correctly. I'd conflated it with the broader term "integer".

I discovered, in significantly more time than it took to find the actual answer, that there are longer runs possible beyond the scope of the solution set. :oops:
I'm very grateful that you posted this. I couldn't figure out why my answer wasn't being accepted, and as soon as I read your post I realised I had made the exact same mistake.

Thank you MithrilTuxedo!
kvom
Posts: 13
Joined: Tue Oct 02, 2007 11:06 pm
Location: Georgia, USA

Re: Problem 093

Post by kvom »

Just got back onto project Euler after a long layoff, and finally figured out an algorithm to solve this problem. Got the correct answer for 1234, and my program finds a maximum sequence of 43. Any hints would be appreciated. Program is conceptually simple and I've spent hours looking at it.
User avatar
Georg
Posts: 157
Joined: Mon Jan 21, 2008 7:00 am
Location: Mannheim, Germany
Contact:

Re: Problem 093

Post by Georg »

Your program should find a longer sequence.
kvom
Posts: 13
Joined: Tue Oct 02, 2007 11:06 pm
Location: Georgia, USA

Re: Problem 093

Post by kvom »

After re-reading this thread I saw that intermediate values could be non-integer as long as the result is integer. Changed algorithm to use floating point for division and got the correct answer.
TiptTop
Posts: 4
Joined: Mon Aug 03, 2015 1:38 am

Re: Problem 093

Post by TiptTop »

What is a "non-expressible number" ?
TripleM
Posts: 384
Joined: Fri Sep 12, 2008 3:31 am

Re: Problem 093

Post by TripleM »

A number which cannot be expressed in the form stated in the problem statement.
TiptTop
Posts: 4
Joined: Mon Aug 03, 2015 1:38 am

Re: Problem 093

Post by TiptTop »

TripleM wrote:A number which cannot be expressed in the form stated in the problem statement.
Is same operation (+ or - or * or /) allowed multiple times but separated by brackets/parentheses?
Post Reply