2018-09-30 23:01:58 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								---
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								id: 5900f4251000cf542c50ff38
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								title: 'Problem 185: Number Mind'
							 
						 
					
						
							
								
									
										
										
										
											2020-11-27 19:02:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								challengeType: 5
							 
						 
					
						
							
								
									
										
										
										
											2019-08-05 09:17:33 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								forumTopicId: 301821
							 
						 
					
						
							
								
									
										
										
										
											2021-01-13 03:31:00 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								dashedName: problem-185-number-mind
							 
						 
					
						
							
								
									
										
										
										
											2018-09-30 23:01:58 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								---
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-11-27 19:02:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# --description--
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-30 23:01:58 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								The game Number Mind is a variant of the well known game Master Mind.
							 
						 
					
						
							
								
									
										
										
										
											2020-11-27 19:02:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-30 23:01:58 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								Instead of coloured pegs, you have to guess a secret sequence of digits. After each guess you're only told in how many places you've guessed the correct digit. So, if the sequence was 1234 and you guessed 2036, you'd be told that you have one correct digit; however, you would NOT be told that you also have another digit in the wrong place.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-07-15 15:52:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								For instance, given the following guesses for a 5-digit secret sequence,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$$\begin{align}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  &  90342 ;2\\;\text{correct}\\\\
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  &  70794 ;0\\;\text{correct}\\\\
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  &  39458 ;2\\;\text{correct}\\\\
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  &  34109 ;1\\;\text{correct}\\\\
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  &  51545 ;2\\;\text{correct}\\\\
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  &  12531 ;1\\;\text{correct}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								\end{align}$$
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								The correct sequence 39542 is unique.
							 
						 
					
						
							
								
									
										
										
										
											2018-09-30 23:01:58 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Based on the following guesses,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-07-15 15:52:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								$$\begin{align}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  &  5616185650518293 ;2\\;\text{correct}\\\\
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  &  3847439647293047 ;1\\;\text{correct}\\\\
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  &  5855462940810587 ;3\\;\text{correct}\\\\
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  &  9742855507068353 ;3\\;\text{correct}\\\\
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  &  4296849643607543 ;3\\;\text{correct}\\\\
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  &  3174248439465858 ;1\\;\text{correct}\\\\
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  &  4513559094146117 ;2\\;\text{correct}\\\\
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  &  7890971548908067 ;3\\;\text{correct}\\\\
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  &  8157356344118483 ;1\\;\text{correct}\\\\
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  &  2615250744386899 ;2\\;\text{correct}\\\\
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  &  8690095851526254 ;3\\;\text{correct}\\\\
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  &  6375711915077050 ;1\\;\text{correct}\\\\
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  &  6913859173121360 ;1\\;\text{correct}\\\\
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  &  6442889055042768 ;2\\;\text{correct}\\\\
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  &  2321386104303845 ;0\\;\text{correct}\\\\
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  &  2326509471271448 ;2\\;\text{correct}\\\\
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  &  5251583379644322 ;2\\;\text{correct}\\\\
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  &  1748270476758276 ;3\\;\text{correct}\\\\
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  &  4895722652190306 ;1\\;\text{correct}\\\\
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  &  3041631117224635 ;3\\;\text{correct}\\\\
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  &  1841236454324589 ;3\\;\text{correct}\\\\
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  &  2659862637316867 ;2\\;\text{correct}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								\end{align}$$
							 
						 
					
						
							
								
									
										
										
										
											2018-09-30 23:01:58 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Find the unique 16-digit secret sequence.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-11-27 19:02:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# --hints--
  
						 
					
						
							
								
									
										
										
										
											2018-09-30 23:01:58 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-07-15 15:52:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								`numberMind()`  should return `4640261571849533` . 
						 
					
						
							
								
									
										
										
										
											2018-09-30 23:01:58 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-11-27 19:02:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```js
							 
						 
					
						
							
								
									
										
										
										
											2021-07-15 15:52:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								assert.strictEqual(numberMind(), 4640261571849533);
							 
						 
					
						
							
								
									
										
										
										
											2018-09-30 23:01:58 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-11-27 19:02:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# --seed--
  
						 
					
						
							
								
									
										
										
										
											2018-09-30 23:01:58 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-11-27 19:02:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								## --seed-contents--
  
						 
					
						
							
								
									
										
										
										
											2018-09-30 23:01:58 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```js
							 
						 
					
						
							
								
									
										
										
										
											2021-07-15 15:52:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function numberMind() {
							 
						 
					
						
							
								
									
										
										
										
											2020-09-15 09:57:40 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-30 23:01:58 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  return true;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-07-15 15:52:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								numberMind();
							 
						 
					
						
							
								
									
										
										
										
											2018-09-30 23:01:58 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-11-27 19:02:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# --solutions--
  
						 
					
						
							
								
									
										
										
										
											2018-09-30 23:01:58 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```js
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// solution required
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```