Brainsteem Compute #3 Prize Computational Maths Puzzle [Win 40% and 10% in SBD] by rycharde

View this thread on steempeak.com
· @rycharde ·
$2.34
Brainsteem Compute #3 Prize Computational Maths Puzzle [Win 40% and 10% in SBD]
Problem #3 is slightly different in that it is more of a research project, perhaps even a collaborative effort. The reason for this is that I'm proposing a question to which I don't know the answer!

We expect a quizmaster to know everything, but a research proposal? Well, it could be brilliant, it might be inconclusive or it might be impossible to compute. So let's find out.


<center>http://i.imgur.com/4bNV5lM.jpg?1</center>

<hr>

<h2>The Background</h2>

Firstly, you must read [Brainsteem Compute #2](https://steemit.com/math/@rycharde/brainsteem-compute-2-prize-computational-maths-puzzle-win-40-and-10-in-sbd) as it has all the background to this question. The standard literature talks about left-truncatable and right-truncatable prime numbers. 

I prefer the term *nested primes* as, in this case, we are going to look at mixing the two algorithms together. It is also easier to think of this as building up the prime from a single digit, rather than step-wise truncating the final answer down to the starting prime.



<h2>The Question</h2>


<h3>Find the largest possible prime number that can be generated by starting with a single-digit prime and adding digits to either the RIGHT or to the LEFT of each prime, so that each number in the sequence is a prime number.</h3>


<h3>We shall exclude zeros, so that we cannot have the sequence: (3, 13, 013, 1013, ...) One example of the start of a sequence is: (3, 13, 137, 2137, 62137, ...) </h3>

For the First Prize, please include a valid method, algorithm or post the code and output. If this sequence is infinite, then try to prove that it is so.

If two different people get each of A and B correct, I shall split the First Prize. All others can participate so long as you have done or attempted either A or B.

Remember that even if you are not the first to post, this remains a learning experience that can help in future Brainsteem challenges.


<hr>

<h2>Prizes</h2>

To qualify you must upvote this post and write the answer in a comment.

To win First Prize you must include the answer *and* a valid method.

<h3>The *First Prize will be 40%* of the earnings generated by this post, paid in SBD.</h3>

The *Second Prize will be 10%* of the earnings generated by this post, awarded to *any other* correct answer in the comments section, chosen at random and paid in SBD.

<h3>Also remember that your upvote generates curation *rewards for you* and that 25% of all earnings are given to upvoters.</h3>

Prizes will be awarded after the 7 days have expired. Winners will be announced in the comments below after the draw.

The Prizes will increase with more participation and as the earnings increase.

The main thing is to enjoy the challenge and maybe learn something new.

---

Come and check out other challenges currently live!

[Brainsteem #9 Prize Maths Puzzle [Win 40% and 10% in SBD]](https://steemit.com/mathematics/@rycharde/brainsteem-9-prize-maths-puzzle-win-40-and-10-in-sbd)

[Brainsteem Compute #2 Prize Computational Maths Puzzle [Win 40% and 10% in SBD]](https://steemit.com/math/@rycharde/brainsteem-compute-2-prize-computational-maths-puzzle-win-40-and-10-in-sbd)

[Brainsteem Quickfire Q4 [Win 40% and 10% in SBD]](https://steemit.com/mathematics/@rycharde/brainsteem-quickfire-q4-win-40-and-10-in-sbd)

[Brainsteem Compute #1 Prize Computational Maths Puzzle [Win 40% and 10% in SBD]](https://steemit.com/mathematics/@rycharde/brainsteem-compute-1-prize-computational-maths-puzzle-win-40-and-10-in-sbd)

[Brainsteem #8 Prize Maths Puzzle [Win 2SBD+1SBD]](https://steemit.com/mathematics/@rycharde/brainsteem-8-prize-maths-puzzle-win-2sbd1sbd)

[Science Cryptic Crossword SCX1 [Win 10 SBD Prize]](https://steemit.com/contest/@rycharde/science-cryptic-crossword-scx1-win-10-sbd-prize)

[Brainsteem #7 Prize Maths Puzzle [Win 2SBD+1SBD]](https://steemit.com/mathematics/@rycharde/brainsteem-7-prize-maths-puzzle-win-2sbd1sbd)


---

Please upvote, resteem and follow @rycharde for more Brainsteems!
I am experimenting with tags, so the easiest way to see all Brainsteems is to follow me. Thanks.

And don't forget to upvote each other's comments to bring cheer to the whole community!
πŸ‘  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
properties (23)
post_id6,010,883
authorrycharde
permlinkbrainsteem-compute-3-prize-computational-maths-puzzle-win-40-and-10-in-sbd
categorymathematics
json_metadata"{"tags": ["mathematics", "brainsteem", "programming", "contest", "python"], "format": "markdown+html", "app": "chainbb/0.3"}"
created2017-07-03 14:53:15
last_update2017-07-03 14:53:15
depth0
children15
net_rshares387,607,476,946
last_payout2017-07-10 14:53:15
cashout_time1969-12-31 23:59:59
total_payout_value2.037 SBD
curator_payout_value0.306 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length4,175
author_reputation19,398,930,083,242
root_title"Brainsteem Compute #3 Prize Computational Maths Puzzle [Win 40% and 10% in SBD]"
beneficiaries
0.
accountchainbb
weight1,500
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (55)
@minnowsupport ·
$0.05
<p>Congratulations!  This post has been upvoted from the communal account, @minnowsupport, by rycharde from the Minnow Support Project.  It's a witness project run by aggroed, ausbitbank, teamsteem, theprophet0, and someguy123.  The goal is to help Steemit grow by supporting Minnows and creating a social network.  Please find us in the <a href="https://discord.gg/HYj4yvw">Peace, Abundance, and Liberty Network (PALnet) Discord Channel</a>.  It's a completely public and open space to all members of the Steemit community who voluntarily choose to be there.</p>

<p>If you like what we're doing please upvote this comment so we can continue to build the community account that's supporting all members.</p>
πŸ‘  
properties (23)
post_id6,022,889
authorminnowsupport
permlinkre-rycharde-brainsteem-compute-3-prize-computational-maths-puzzle-win-40-and-10-in-sbd-20170703t164847062z
categorymathematics
json_metadata"{"app": "cosgrove/0.0.1rc3", "tags": ["mathematics"]}"
created2017-07-03 16:48:45
last_update2017-07-03 16:48:45
depth1
children0
net_rshares7,788,144,397
last_payout2017-07-10 16:48:45
cashout_time1969-12-31 23:59:59
total_payout_value0.044 SBD
curator_payout_value0.008 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length709
author_reputation104,981,098,086,561
root_title"Brainsteem Compute #3 Prize Computational Maths Puzzle [Win 40% and 10% in SBD]"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (1)
@happychau123 ·
this is some crazy demand of computational power.....
properties (22)
post_id6,029,564
authorhappychau123
permlinkre-rycharde-brainsteem-compute-3-prize-computational-maths-puzzle-win-40-and-10-in-sbd-20170703t174833460z
categorymathematics
json_metadata"{"app": "steemit/0.1", "tags": ["mathematics"]}"
created2017-07-03 17:50:54
last_update2017-07-03 17:50:54
depth1
children2
net_rshares0
last_payout2017-07-10 17:50:54
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length53
author_reputation1,501,988,704,632
root_title"Brainsteem Compute #3 Prize Computational Maths Puzzle [Win 40% and 10% in SBD]"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@rycharde ·
$0.30
But can you do it? :-)

I think it's an obvious follow-up question. It's not as hard as finding the highest prime. Each step is simple. 
We can even draw nice graphs like the Collatz conjecture.
πŸ‘  , , ,
properties (23)
post_id6,033,327
authorrycharde
permlinkre-happychau123-re-rycharde-brainsteem-compute-3-prize-computational-maths-puzzle-win-40-and-10-in-sbd-20170703t174833460z-201774t12755297z
categorymathematics
json_metadata"{"tags": [], "format": "markdown+html", "app": "chainbb/0.3"}"
created2017-07-03 18:28:00
last_update2017-07-03 18:28:00
depth2
children1
net_rshares51,100,400,947
last_payout2017-07-10 18:28:00
cashout_time1969-12-31 23:59:59
total_payout_value0.292 SBD
curator_payout_value0.004 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length194
author_reputation19,398,930,083,242
root_title"Brainsteem Compute #3 Prize Computational Maths Puzzle [Win 40% and 10% in SBD]"
beneficiaries
0.
accountchainbb
weight1,500
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (4)
@happychau123 ·
$0.09
I don't think I can do this....
Last time to find the highest left truncatable prime is near my hardware's memory limit, This number is for sure larger than that one
but I will try from tmr :)
πŸ‘  , ,
properties (23)
post_id6,034,306
authorhappychau123
permlinkre-rycharde-re-happychau123-re-rycharde-brainsteem-compute-3-prize-computational-maths-puzzle-win-40-and-10-in-sbd-20170703t174833460z-201774t12755297z-201774t23451497z
categorymathematics
json_metadata"{"tags": [], "format": "markdown+html", "app": "chainbb/0.3"}"
created2017-07-03 18:37:12
last_update2017-07-03 18:37:12
depth3
children0
net_rshares15,588,708,497
last_payout2017-07-10 18:37:12
cashout_time1969-12-31 23:59:59
total_payout_value0.084 SBD
curator_payout_value0.004 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length192
author_reputation1,501,988,704,632
root_title"Brainsteem Compute #3 Prize Computational Maths Puzzle [Win 40% and 10% in SBD]"
beneficiaries
0.
accountchainbb
weight1,500
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (3)
@rycharde ·
$0.25
Each prime p(n) has 14 potential values for p(n+1), compared to 9 for the left-truncated primes.
πŸ‘  , ,
properties (23)
post_id6,033,655
authorrycharde
permlinkre-rycharde-brainsteem-compute-3-prize-computational-maths-puzzle-win-40-and-10-in-sbd-201774t1314947z
categorymathematics
json_metadata"{"tags": [], "format": "markdown+html", "app": "chainbb/0.3"}"
created2017-07-03 18:31:09
last_update2017-07-03 18:31:09
depth1
children1
net_rshares42,439,413,828
last_payout2017-07-10 18:31:09
cashout_time1969-12-31 23:59:59
total_payout_value0.244 SBD
curator_payout_value0.001 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length96
author_reputation19,398,930,083,242
root_title"Brainsteem Compute #3 Prize Computational Maths Puzzle [Win 40% and 10% in SBD]"
beneficiaries
0.
accountchainbb
weight1,500
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (3)
@happychau123 ·
$0.04
For sure I cant do this with 100% confidence level prime checks.
But it sounds still possible to do with strong prime checks :)
πŸ‘  ,
properties (23)
post_id6,034,442
authorhappychau123
permlinkre-rycharde-re-rycharde-brainsteem-compute-3-prize-computational-maths-puzzle-win-40-and-10-in-sbd-201774t1314947z-201774t23617465z
categorymathematics
json_metadata"{"tags": [], "format": "markdown+html", "app": "chainbb/0.3"}"
created2017-07-03 18:38:36
last_update2017-07-03 18:38:36
depth2
children0
net_rshares7,218,114,348
last_payout2017-07-10 18:38:36
cashout_time1969-12-31 23:59:59
total_payout_value0.036 SBD
curator_payout_value0.007 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length127
author_reputation1,501,988,704,632
root_title"Brainsteem Compute #3 Prize Computational Maths Puzzle [Win 40% and 10% in SBD]"
beneficiaries
0.
accountchainbb
weight1,500
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (2)
@happychau123 ·
$0.20
Oh god. Too hard for me, any solution from your side? @rycharde
πŸ‘  , ,
properties (23)
post_id6,212,677
authorhappychau123
permlinkre-rycharde-brainsteem-compute-3-prize-computational-maths-puzzle-win-40-and-10-in-sbd-201775t181625421z
categorymathematics
json_metadata"{"tags": [], "format": "markdown+html", "app": "chainbb/0.3"}"
created2017-07-05 10:18:00
last_update2017-07-05 10:18:00
depth1
children2
net_rshares42,803,078,130
last_payout2017-07-12 10:18:00
cashout_time1969-12-31 23:59:59
total_payout_value0.190 SBD
curator_payout_value0.006 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length63
author_reputation1,501,988,704,632
root_title"Brainsteem Compute #3 Prize Computational Maths Puzzle [Win 40% and 10% in SBD]"
beneficiaries
0.
accountchainbb
weight1,500
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (3)
@rycharde ·
All I can say is that I am not the first one to have thought of the question and that there is solution and that it has less than 50 digits.
properties (22)
post_id6,247,911
authorrycharde
permlinkre-happychau123-re-rycharde-brainsteem-compute-3-prize-computational-maths-puzzle-win-40-and-10-in-sbd-201775t181625421z-201776t0543844z
categorymathematics
json_metadata"{"tags": [], "format": "markdown+html", "app": "chainbb/0.3"}"
created2017-07-05 17:05:54
last_update2017-07-05 17:05:54
depth2
children1
net_rshares0
last_payout2017-07-12 17:05:54
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length140
author_reputation19,398,930,083,242
root_title"Brainsteem Compute #3 Prize Computational Maths Puzzle [Win 40% and 10% in SBD]"
beneficiaries
0.
accountchainbb
weight1,500
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@happychau123 ·
OK... lemme try again lol
properties (22)
post_id6,248,285
authorhappychau123
permlinkre-rycharde-re-happychau123-re-rycharde-brainsteem-compute-3-prize-computational-maths-puzzle-win-40-and-10-in-sbd-201775t181625421z-201776t0543844z-201776t1857203z
categorymathematics
json_metadata"{"tags": [], "format": "markdown+html", "app": "chainbb/0.3"}"
created2017-07-05 17:10:33
last_update2017-07-05 17:10:33
depth3
children0
net_rshares0
last_payout2017-07-12 17:10:33
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length25
author_reputation1,501,988,704,632
root_title"Brainsteem Compute #3 Prize Computational Maths Puzzle [Win 40% and 10% in SBD]"
beneficiaries
0.
accountchainbb
weight1,500
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@quantumdeveloper ·
$0.02
That was fun!

The result should be:
`8939662423123592347173339993799`
Due to using some java-intern prime check my confidence is *only*
`1-0.5²¹⁴⁷⁴⁸³⁢⁴⁷`(I hate how the unicode superscript characters appear on different heights.)
And here is my (java) code:
```
	static BigInteger TEN = new BigInteger("10");
	static BigInteger MAX = new BigInteger("3");
	static BigInteger [] digits = new BigInteger[10];
	public static void main(String[] args) {
		for(int i = 0; i < 10; i++) {
			digits[i] = new BigInteger(i+"");
		}
		for(int i = 3; i < 10; i += 2) {
			makeChain(new BigInteger(i+""), 1);
		}
	}
	public static void makeChain(BigInteger start, int depth) {
		if(start.isProbablePrime(Integer.MAX_VALUE)) {
			if(start.compareTo(MAX) == 1) {
				MAX = start;
				System.out.println(MAX);
			}
		}
		else
			return;
		for(int i = 1; i < 10; i += 2) {
			if(i == 5)
				continue;
			makeChain(appendRight(start, i), depth+1);
		}
		for(int i = 1; i < 10; i++) {
			makeChain(appendLeft(start, i, depth), depth+1);
		}
	}
	public static BigInteger appendRight(BigInteger bi, int digit) {
		return bi.multiply(TEN).add(digits[digit]);
	}
	public static BigInteger appendLeft(BigInteger bi, int digit, int depth) {
		return bi.add(TEN.pow(depth).multiply(digits[digit]));
	}
```
Well, it's basically just brute-force.
πŸ‘  ,
properties (23)
post_id79,522,143
authorquantumdeveloper
permlinkpwynf0
categorymathematics
json_metadata{"tags":["mathematics"],"app":"steemit\/0.1"}
created2019-08-28 18:59:24
last_update2019-08-28 18:59:24
depth1
children5
net_rshares101,137,623,794
last_payout2019-09-04 18:59:24
cashout_time1969-12-31 23:59:59
total_payout_value0.010 SBD
curator_payout_value0.009 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length1,318
author_reputation4,501,252,062,061
root_title"Brainsteem Compute #3 Prize Computational Maths Puzzle [Win 40% and 10% in SBD]"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (2)
@rycharde ·
That's great! You *will* find others that were left unanswered.

Some, as in this case, I made up myself but then had a look to see if anybody else had the same idea.

Sometimes the brute force methods need some thoughtful algorithmic assistance to avoid the numbers or processing times going ballistic.
properties (22)
post_id79,543,215
authorrycharde
permlinkpwzza5
categorymathematics
json_metadata{"tags":["mathematics"],"app":"steemit\/0.1"}
created2019-08-29 12:13:18
last_update2019-08-29 12:13:18
depth2
children1
net_rshares0
last_payout2019-09-05 12:13:18
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length303
author_reputation19,398,930,083,242
root_title"Brainsteem Compute #3 Prize Computational Maths Puzzle [Win 40% and 10% in SBD]"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@quantumdeveloper ·
You will find others that were left unanswered.

I can't find them. Either I didn't look thoroughly, or there are brainsteems without the tag.
properties (22)
post_id79,590,737
authorquantumdeveloper
permlinkpx2kcb
categorymathematics
json_metadata{"tags":["mathematics"],"app":"steemit\/0.1"}
created2019-08-30 21:43:24
last_update2019-08-30 21:43:24
depth3
children0
net_rshares0
last_payout2019-09-06 21:43:24
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length142
author_reputation4,501,252,062,061
root_title"Brainsteem Compute #3 Prize Computational Maths Puzzle [Win 40% and 10% in SBD]"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@rycharde ·
You wanted a prize! LOL. Well, as the original prize was a cut of the post profits, then converted to new model steem is probably worth a few cents ;-)

However, worth the effort and interest. Let me offer you either 1 MAPR token or 1 MAXUV token, both worth about 1 STEEM (even after HF21). Let me know which you prefer.

BTW, your solution is correct, and can be found here [on OEIS](https://oeis.org/A137812), one of those amazing internet niche resources.
properties (22)
post_id79,575,304
authorrycharde
permlinkpx1ove
categorymathematics
json_metadata{"tags":["mathematics"],"links":["https:\/\/oeis.org\/A137812"],"app":"steemit\/0.1"}
created2019-08-30 10:23:39
last_update2019-08-30 10:23:39
depth2
children2
net_rshares0
last_payout2019-09-06 10:23:39
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length459
author_reputation19,398,930,083,242
root_title"Brainsteem Compute #3 Prize Computational Maths Puzzle [Win 40% and 10% in SBD]"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@quantumdeveloper ·
Thank you, for the prize and for the fact that you finally told me wether my solution was right.

I choose to take the MAPR token.
properties (22)
post_id79,583,249
authorquantumdeveloper
permlinkpx2410
categorymathematics
json_metadata{"tags":["mathematics"],"app":"steemit\/0.1"}
created2019-08-30 15:51:00
last_update2019-08-30 15:51:00
depth3
children1
net_rshares0
last_payout2019-09-06 15:51:00
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length130
author_reputation4,501,252,062,061
root_title"Brainsteem Compute #3 Prize Computational Maths Puzzle [Win 40% and 10% in SBD]"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000