Problem 049

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.
Slock
Posts: 4
Joined: Wed Feb 27, 2008 12:20 pm

Problem 049

Post by Slock »

I need some clarification on this problem, I must be missing some detail.
The arithmetic sequence, 1487, 4817, 8147, in which each of the terms increases by 3330, is unusual in two ways: (i) each of the three terms are prime, and, (ii) each of the 4-digit numbers are permutations of one another.

There are no arithmetic sequences made up of three 1-, 2-, or 3-digit primes, exhibiting this property, but there is one other 4-digit increasing sequence.

What 12-digit number do you form by concatenating the three terms in this sequence?
Now as far as I can tell, the sequence they give us is 3 x 4-digit long numbers. Each number is prime. Each number is separated by the next by 3330. And each one is a permutation of the first term. They want the only other 4 digit prime sequence just like this. Now my problem is I found more then that.
Expand
Edit: Removed spoiler,hk
1487 4817 8147
2963 6293 9623
...
...
...
...
...
I high lighted the one they gave us. Now each row contains 3 x 4-digit long numbers. Each number is prime. Each number is seperated by the next by 3330. And each one is a permutation of the first. What am I misunderstanding?

Thank you,
Last edited by Slock on Wed Feb 27, 2008 2:27 pm, edited 1 time in total.

User avatar
hk
Administrator
Posts: 10870
Joined: Sun Mar 26, 2006 10:34 am
Location: Haren, Netherlands

Re: Problem 49

Post by hk »

E.g. 6293=7*29*31. So there is something wrong with your primality checking.
Would you mind weeping out the numbers you posted here. It's too revealing to leave them out here.
Image

Slock
Posts: 4
Joined: Wed Feb 27, 2008 12:20 pm

Re: Problem 49

Post by Slock »

I spoiler-ed the numbers.


And thanks, in one of the revisions of my code, I removed checking for the primality of the 2nd two numbers.

Lazaruspl
Posts: 1
Joined: Tue Nov 17, 2009 1:15 pm

Problem 049

Post by Lazaruspl »

I don't think I clearly understand problem 49. Because I found this number:
100005841487 which is pre
So I can increase it for example by number 3330 and:
100005841487+3330 = 10000584817 is also pre
Than I increase 10000584817 by 3330 so now I have:
10000588147 which also is pre.

Those numbers are permutations of one another, so they are concatenating the three terms in sequence, but my answer is bad. Did I understand something wrong ?

harryh
Posts: 2091
Joined: Tue Aug 22, 2006 9:33 pm
Location: Thessaloniki, Greece

Re: Problem 049

Post by harryh »

According to the Problem 49 (View Problem), you should be looking for three 4-digit numbers.
Then you concatenate them and submit the 12-digits as your answer.
E.g. if your three numbers were 1111, 2222 and 3333 you would submit 111122223333 as your answer.

Also, before starting a new topic for a problem, please make sure that no such topic exists.

slindeneau
Posts: 4
Joined: Thu Jun 16, 2011 12:34 am

Re: Problem 049

Post by slindeneau »

Do numbers prefixed with a 0 count as a 4 digit number? I am assuming no, otherwise there would be more solutions perhaps?

Just to clarify, 0111 is NOT a 4 digit sequence right? It would be considered a 3 digit sequence?

User avatar
rayfil
Administrator
Posts: 1405
Joined: Sun Mar 26, 2006 5:30 am
Location: Quebec, Canada
Contact:

Re: Problem 049

Post by rayfil »

0111 is NOT a 4 digit sequence
That is absolutely correct. Leading 0's are not allowed.
When you assume something, you risk being wrong half the time.

xe3tec
Posts: 46
Joined: Thu May 05, 2011 8:52 am
Location: Vienna
Contact:

Re: Problem 049

Post by xe3tec »

Must it be a difference of 3330 or is this just in the example?
Because I only can find 1 other, but the first number woudlnt be 4 digit...

User avatar
hk
Administrator
Posts: 10870
Joined: Sun Mar 26, 2006 10:34 am
Location: Haren, Netherlands

Re: Problem 049

Post by hk »

xe3tec wrote:Must it be a difference of 3330 or is this just in the example?
just in the example.
Image

xe3tec
Posts: 46
Joined: Thu May 05, 2011 8:52 am
Location: Vienna
Contact:

Re: Problem 049

Post by xe3tec »

thought so...

makes it more difficult

but the diff between the primes has to been the same, correct?

thundre
Posts: 356
Joined: Sun Mar 27, 2011 10:01 am

Re: Problem 049

Post by thundre »

xe3tec wrote:but the diff between the primes has to been the same, correct?
Yes, p3-p2 = p2-p1
Image

glsetlif
Posts: 1
Joined: Tue Feb 19, 2013 9:47 pm

Re: Problem 049

Post by glsetlif »

[removed by euler] There are 26 different sequences of 4-digit prime permutations with various equal separation between the numbers (3000, 450, 300, etc.). The question is looking for the other sequence with the three numbers separated by the exact amount in the example.

User avatar
euler
Administrator
Posts: 3310
Joined: Sun Mar 05, 2006 4:49 pm
Location: Cheshire, England
Contact:

Re: Problem 049

Post by euler »

I edited your post to remove a major spoiler.

I think you missed one of the subtle "rules": each of the 4-digit primes are permutations of one another. In the example given you will notice that 1487, 4817, and 8147 all share the same four digits. There is only one other arithmetic sequence made up of 4-digit primes with this property and the problem is about finding that particular sequence.
Image
impudens simia et macrologus profundus fabulae

spaceninja
Posts: 1
Joined: Mon May 06, 2013 5:27 am

Re: Problem 049

Post by spaceninja »

I've found 16 sets of three 4-digit primes that are all permutations of each other.
Unfortunately none of these exhibit the property that p3 - p2 = p2 - p1

I'm not sure what I'm missing here.

thundre
Posts: 356
Joined: Sun Mar 27, 2011 10:01 am

Re: Problem 049

Post by thundre »

spaceninja wrote:I've found 16 sets of three 4-digit primes that are all permutations of each other.
Unfortunately none of these exhibit the property that p3 - p2 = p2 - p1

I'm not sure what I'm missing here.
You're missing a lot of sets. I see over 100.

Some sets contain more than 3 elements. There are some 10-number sets of 4-digit primes which are permutations of the same digits. There are 10C3 = 120 subsets of size 3 to check within each set of size 10, if that's the way you're doing the problem.
Image

silent
Posts: 1
Joined: Mon Aug 05, 2013 11:33 am

Re: Problem 049

Post by silent »

i can only finde the given example numbertriple 1487, 4817, 8147 with a distance of 3330. Up to a distance unter 5000 i cant find any other 4 digit number triple :? and i can finde any fold in my code

thundre
Posts: 356
Joined: Sun Mar 27, 2011 10:01 am

Re: Problem 049

Post by thundre »

silent wrote:i can only finde the given example numbertriple 1487, 4817, 8147 with a distance of 3330. Up to a distance unter 5000 i cant find any other 4 digit number triple :? and i can finde any fold in my code
I sent you a PM.
Image

devrelm
Posts: 3
Joined: Wed Apr 02, 2014 4:44 am

Re: Problem 049

Post by devrelm »

silent wrote:i can only finde the given example numbertriple 1487, 4817, 8147 with a distance of 3330. Up to a distance unter 5000 i cant find any other 4 digit number triple :? and i can finde any fold in my code
I'm having the same problem. I've rewritten the code a half-dozen times, added perf improvements and changed the algo up a couple times. But every single time I get the given sequence (1487, 4817, 8147) with nothing else. I get the feeling that I'm going to feel really foolish if/when I figure this out...

petersc
Posts: 7
Joined: Fri Feb 24, 2012 2:55 pm

Re: Problem 049

Post by petersc »

Why under 5000 for 4-digit sequence?

devrelm
Posts: 3
Joined: Wed Apr 02, 2014 4:44 am

Re: Problem 049

Post by devrelm »

petersc wrote:Why under 5000 for 4-digit sequence?
The maximum distance between two 4-digit numbers is 9999-1000=8999, and so if you put a number half-way between those, you'd get a distance of 8999/2~=4500 between each number in the sequence. It's basically just a performance improvement, and I'm actually doing something a little smarter myself to prevent unnecessary checks. Ultimately, though, it doesn't matter if I check every diff from 1-10000; I still find the given sequence, but no second sequence.

My next job is to scrap the algo again and try something a bit less brute-force-ish.

Post Reply