Problem 361
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.
-
jovo_amf
- Posts: 1
- Joined: Thu Dec 08, 2011 9:51 pm
-
thundre
- Posts: 356
- Joined: Sun Mar 27, 2011 10:01 am
Re: Problem 361
T = 01101001100101101001011001101001...jovo_amf wrote:Can someone explain to me why A(12) = 18?
A(12)=18 because 14 through 17 never appear in T.
14: 1110
15: 1111
16: 10000
17: 10001
18: 10010 does appear, so that is the next A.

-
mantonetti
- Posts: 3
- Joined: Thu Jan 26, 2012 11:00 pm
Re: Problem 361
Maybe my English is not enough to understand the terms of the problem, but I think there is an error: the number 4 (bin 100) appears in the sequence in places T4-T6, while the number 5 (bin 101) appears in places T3-T5 (so before number 4), and therefore to A4 should correspond n = 5 and to A5 should correspond n = 4.
Of course maybe that I didn't understand in which way n is associated with An; can someone clarify, please?
Of course maybe that I didn't understand in which way n is associated with An; can someone clarify, please?

- Marcus_Andrews
- Administrator
- Posts: 1637
- Joined: Wed Nov 09, 2011 5:23 pm
Re: Problem 361
The question isn't asking about which binary expressions appear before/after other binary expressions. {An} is a sorted sequence of integers such that those integers have binary expressions somewhere in the Thue-Morse sequence {Tn}. 4 and 5's binary representations exist in {Tn}, so 4 and 5 are included in the sorted sequence {An}.
Example: Putting aside the 0-case, A(100) = 3251 means that the 100th element of {An} is 3251. Similarly, the 12th element is 18.
Example: Putting aside the 0-case, A(100) = 3251 means that the 100th element of {An} is 3251. Similarly, the 12th element is 18.
-
mantonetti
- Posts: 3
- Joined: Thu Jan 26, 2012 11:00 pm
-
ffff0
- Posts: 50
- Joined: Sun Aug 21, 2011 6:26 am
- Location: Moscow, Russian Federation
Re: Problem 361
Just wonder how many memory is required for this problem since A(10^18) has more than 2*10^9 binary digits and there are more than 3*10^9 numbers of such length?
Last edited by ffff0 on Tue Jul 17, 2012 5:01 am, edited 1 time in total.

-
TripleM
- Posts: 384
- Joined: Fri Sep 12, 2008 3:31 am
Re: Problem 361
But you only need the last 9 digits 
You will never need an excessive amount of memory for a Project Euler problem.
You will never need an excessive amount of memory for a Project Euler problem.
-
ffff0
- Posts: 50
- Joined: Sun Aug 21, 2011 6:26 am
- Location: Moscow, Russian Federation
Re: Problem 361
I know, but right now I need to store all tree to know which number is the right one.
Will keep thinking.
Will keep thinking.

- Marcus_Andrews
- Administrator
- Posts: 1637
- Joined: Wed Nov 09, 2011 5:23 pm
Re: Problem 361
The problem is able to be solved in under a second and with very little memory usage.
-
ffff0
- Posts: 50
- Joined: Sun Aug 21, 2011 6:26 am
- Location: Moscow, Russian Federation
Re: Problem 361
Looks like I'll learn this method from solution thread after brute-forsing right answer.

-
thundre
- Posts: 356
- Joined: Sun Mar 27, 2011 10:01 am
Re: Problem 361
My best-so-far solution (which I wouldn't call brute-force) bogged after 1014.ffff0 wrote:Looks like I'll learn this method from solution thread after brute-forsing right answer.
It is quite an interesting sequence.

-
ffff0
- Posts: 50
- Joined: Sun Aug 21, 2011 6:26 am
- Location: Moscow, Russian Federation
Re: Problem 361
Last steps of my method are brute-force. It takes 30 minutes and 2 GB of RAM to get an answer.
