| 
									
										
										
										
											2021-06-15 00:49:18 -07:00
										 |  |  | --- | 
					
						
							|  |  |  | id: 5900f4be1000cf542c50ffd0 | 
					
						
							| 
									
										
										
										
											2021-11-19 10:31:54 -08:00
										 |  |  | title: 'Problema 337: Sequências de degraus totientes' | 
					
						
							| 
									
										
										
										
											2021-06-15 00:49:18 -07:00
										 |  |  | challengeType: 5 | 
					
						
							|  |  |  | forumTopicId: 301995 | 
					
						
							|  |  |  | dashedName: problem-337-totient-stairstep-sequences | 
					
						
							|  |  |  | --- | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # --description--
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-11-19 10:31:54 -08:00
										 |  |  | Considere $\\{a_1, a_2, \ldots, a_n\\}$ como uma sequência de números inteiros de comprimento $n$, tal que: | 
					
						
							| 
									
										
										
										
											2021-06-15 00:49:18 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-11-19 10:31:54 -08:00
										 |  |  | - $a_1 = 6$ | 
					
						
							|  |  |  | - para todo $1 ≤ i < n$ : $φ(a_i) < φ(a_{i + 1}) < a_i < a_{i + 1}$ | 
					
						
							| 
									
										
										
										
											2021-06-15 00:49:18 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-11-19 10:31:54 -08:00
										 |  |  | $φ$ denota a função totiente de Euler. | 
					
						
							| 
									
										
										
										
											2021-06-15 00:49:18 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-11-19 10:31:54 -08:00
										 |  |  | Considere $S(N)$ como o número dessas sequências, com $a_n ≤ N$. | 
					
						
							| 
									
										
										
										
											2021-06-15 00:49:18 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-11-19 10:31:54 -08:00
										 |  |  | Por exemplo, $S(10) = 4$: {6}, {6, 8}, {6, 8, 9} e {6, 10}. | 
					
						
							| 
									
										
										
										
											2021-06-15 00:49:18 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-11-19 10:31:54 -08:00
										 |  |  | Podemos verificar que $S(100) = 482.073.668$ e $S(10.000)\bmod {10}^8 = 73.808.307$. | 
					
						
							| 
									
										
										
										
											2021-06-15 00:49:18 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-11-19 10:31:54 -08:00
										 |  |  | Encontre $S(20.000.000)\bmod {10}^8$. | 
					
						
							| 
									
										
										
										
											2021-06-15 00:49:18 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # --hints--
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-11-19 10:31:54 -08:00
										 |  |  | `totientStairstepSequences()` deve retornar `85068035`. | 
					
						
							| 
									
										
										
										
											2021-06-15 00:49:18 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | ```js | 
					
						
							| 
									
										
										
										
											2021-11-19 10:31:54 -08:00
										 |  |  | assert.strictEqual(totientStairstepSequences(), 85068035); | 
					
						
							| 
									
										
										
										
											2021-06-15 00:49:18 -07:00
										 |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # --seed--
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ## --seed-contents--
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ```js | 
					
						
							| 
									
										
										
										
											2021-11-19 10:31:54 -08:00
										 |  |  | function totientStairstepSequences() { | 
					
						
							| 
									
										
										
										
											2021-06-15 00:49:18 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |   return true; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-11-19 10:31:54 -08:00
										 |  |  | totientStairstepSequences(); | 
					
						
							| 
									
										
										
										
											2021-06-15 00:49:18 -07:00
										 |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # --solutions--
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ```js | 
					
						
							|  |  |  | // solution required | 
					
						
							|  |  |  | ``` |