chore(i18n,curriculum): update translations (#44283)
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5895f70cf9fc0f352b528e67
|
id: 5895f70cf9fc0f352b528e67
|
||||||
title: Implement the Serialization of a Passport User
|
title: Implementa la serialización de un usuario Passport
|
||||||
challengeType: 2
|
challengeType: 2
|
||||||
forumTopicId: 301556
|
forumTopicId: 301556
|
||||||
dashedName: implement-the-serialization-of-a-passport-user
|
dashedName: implement-the-serialization-of-a-passport-user
|
||||||
@ -8,11 +8,11 @@ dashedName: implement-the-serialization-of-a-passport-user
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Right now, we're not loading an actual user object since we haven't set up our database. This can be done many different ways, but for our project we will connect to the database once when we start the server and keep a persistent connection for the full life-cycle of the app. To do this, add your database's connection string (for example: `mongodb+srv://:@cluster0-jvwxi.mongodb.net/?retryWrites=true&w=majority`) to the environment variable `MONGO_URI`. This is used in the `connection.js` file.
|
Ahora mismo, no estamos cargando un objeto de usuario real ya que no hemos configurado nuestra base de datos. Esto puede hacerse de muchas maneras, pero para nuestro proyecto nos conectaremos a la base de datos una vez cuando iniciemos el servidor y mantendremos una conexión persistente durante todo el ciclo de vida de la aplicación. Para hacer esto, agrega la cadena de conexión de tu base de datos (por ejemplo: `mongodb+srv://:@cluster0-jvwxi.mongodb.net/?retryWrites=true&w=majority`) a la variable de entorno `MONGO_URI`. Esto se utiliza en el archivo `connection.js`.
|
||||||
|
|
||||||
*You can set up a free database on [MongoDB Atlas](https://www.mongodb.com/cloud/atlas).*
|
*Puedes configurar una base de datos gratuita en [MongoDB Atlas](https://www.mongodb.com/cloud/atlas).*
|
||||||
|
|
||||||
Now we want to connect to our database then start listening for requests. The purpose of this is to not allow requests before our database is connected or if there is a database error. To accomplish this, you will want to encompass your serialization and your app routes in the following code:
|
Ahora queremos conectarnos a nuestra base de datos y empezar a escuchar las peticiones. El propósito de esto es no permitir peticiones antes de que nuestra base de datos esté conectada o si hay un error en la base de datos. Para lograr esto, querrás englobar tu serialización y las rutas de tu aplicación en el siguiente código:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
myDB(async client => {
|
myDB(async client => {
|
||||||
@ -38,13 +38,13 @@ myDB(async client => {
|
|||||||
// app.listen out here...
|
// app.listen out here...
|
||||||
```
|
```
|
||||||
|
|
||||||
Be sure to uncomment the `myDataBase` code in `deserializeUser`, and edit your `done(null, null)` to include the `doc`.
|
Asegúrate de descomentar el código `myDataBase` en `deserializeUser`, y edita tu `done(null, null)` para incluir el `doc`.
|
||||||
|
|
||||||
Submit your page when you think you've got it right. If you're running into errors, you can check out the project completed up to this point [here](https://gist.github.com/camperbot/175f2f585a2d8034044c7e8857d5add7).
|
Envía tu página cuando creas que lo has hecho bien. Si te encuentras con errores, puedes revisar el proyecto completado hasta este punto [aquí](https://gist.github.com/camperbot/175f2f585a2d8034044c7e8857d5add7).
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
Database connection should be present.
|
La conexión a la base de datos debe estar presente.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
(getUserInput) =>
|
(getUserInput) =>
|
||||||
@ -62,7 +62,7 @@ Database connection should be present.
|
|||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
Deserialization should now be correctly using the DB and `done(null, null)` should be called with the `doc`.
|
La deserialización ahora debe ser correcta usando la BD y `done(null, null)` debe ser llamado con el `doc`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
(getUserInput) =>
|
(getUserInput) =>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 589a69f5f9fc0f352b528e70
|
id: 589a69f5f9fc0f352b528e70
|
||||||
title: Implementation of Social Authentication
|
title: Implementación de la autentificación social
|
||||||
challengeType: 2
|
challengeType: 2
|
||||||
forumTopicId: 301559
|
forumTopicId: 301559
|
||||||
dashedName: implementation-of-social-authentication
|
dashedName: implementation-of-social-authentication
|
||||||
@ -8,21 +8,21 @@ dashedName: implementation-of-social-authentication
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
The basic path this kind of authentication will follow in your app is:
|
La ruta básica que seguirá este tipo de autenticación en tu aplicación es:
|
||||||
|
|
||||||
1. User clicks a button or link sending them to our route to authenticate using a specific strategy (e.g. GitHub).
|
1. El usuario hace clic en un botón o enlace enviándolos a nuestra ruta para autentificarse utilizando una estrategia específica (por ejemplo, GitHub).
|
||||||
2. Your route calls `passport.authenticate('github')` which redirects them to GitHub.
|
2. Tu ruta llama a `passport.authenticate('github')` que los redirige a GitHub.
|
||||||
3. The page the user lands on, on GitHub, allows them to login if they aren't already. It then asks them to approve access to their profile from our app.
|
3. La página en la que aterriza el usuario, en GitHub, le permite iniciar sesión si aún no lo ha hecho. Luego les pide que aprueben el acceso a su perfil desde nuestra aplicación.
|
||||||
4. The user is then returned to our app at a specific callback url with their profile if they are approved.
|
4. El usuario es devuelto a nuestra aplicación en una callback url específica con su perfil si es aprobado.
|
||||||
5. They are now authenticated, and your app should check if it is a returning profile, or save it in your database if it is not.
|
5. Ahora están autentificados, y tu aplicación debe comprobar si es un perfil que vuelve, o guardarlo en tu base de datos si no lo es.
|
||||||
|
|
||||||
Strategies with OAuth require you to have at least a *Client ID* and a *Client Secret* which is a way for the service to verify who the authentication request is coming from and if it is valid. These are obtained from the site you are trying to implement authentication with, such as GitHub, and are unique to your app--**THEY ARE NOT TO BE SHARED** and should never be uploaded to a public repository or written directly in your code. A common practice is to put them in your `.env` file and reference them like so: `process.env.GITHUB_CLIENT_ID`. For this challenge we're going to use the GitHub strategy.
|
Las estrategias con OAuth requieren que tengas al menos un *Client ID* y un *Client Secret* que es una forma de que el servicio verifique de quién viene la solicitud de autentificación y si es válida. Estos se obtienen del sitio con el que intentas implementar la autentificación, como GitHub, y son únicos para tu aplicación: **NO SE DEBEN COMPARTIR** y nunca deben subirse a un repositorio público ni escribirse directamente en tu código. Una práctica común es ponerlos en tu archivo `.env` y referenciarlos así: `process.env.GITHUB_CLIENT_ID`. Para este desafío vamos a usar la estrategia de GitHub.
|
||||||
|
|
||||||
Obtaining your *Client ID and Secret* from GitHub is done in your account profile settings under 'developer settings', then '[OAuth applications](https://github.com/settings/developers)'. Click 'Register a new application', name your app, paste in the url to your Replit homepage (**Not the project code's url**), and lastly, for the callback url, paste in the same url as the homepage but with `/auth/github/callback` added on. This is where users will be redirected for us to handle after authenticating on GitHub. Save the returned information as `'GITHUB_CLIENT_ID'` and `'GITHUB_CLIENT_SECRET'` in your `.env` file.
|
Obtener tu *Client ID y Secret* de GitHub se realiza en la configuración del perfil de tu cuenta, en 'developer settings', y luego en '[OAuth applications](https://github.com/settings/developers)'. Haz clic en 'Register a new application', dale un nombre a tu aplicación, pega la url de tu página de inicio de Replit (**No la url del código del proyecto**), y por último, para la url de callback, pega la misma url de la página de inicio pero con `/auth/github/callback` añadido. Aquí es donde los usuarios serán redirigidos para que los manejemos después de autentificarse en GitHub. Guarda la información devuelta como `'GITHUB_CLIENT_ID'` y `'GITHUB_CLIENT_SECRET'` en tu archivo `.env`.
|
||||||
|
|
||||||
In your `routes.js` file, add `showSocialAuth: true` to the homepage route, after `showRegistration: true`. Now, create 2 routes accepting GET requests: `/auth/github` and `/auth/github/callback`. The first should only call passport to authenticate `'github'`. The second should call passport to authenticate `'github'` with a failure redirect to `/`, and then if that is successful redirect to `/profile` (similar to our last project).
|
En tu archivo `routes.js`, agrega `showSocialAuth: true` a la ruta de la página de inicio, después de `showRegistration: true`. Ahora, crea 2 rutas aceptando peticiones GET: `/auth/github` y `/auth/github/callback`. La primera solo debe llamar al passport para autentificar `'github'`. El segundo debe llamar a passport para autentificar `'github'` con una redirección de fallo a `/`, y luego si eso es exitoso redirigir a `/profile` (similar a nuestro último proyecto).
|
||||||
|
|
||||||
An example of how `/auth/github/callback` should look is similar to how we handled a normal login:
|
Un ejemplo de cómo debe ser `/auth/github/callback` es similar a cómo manejamos un inicio de sesión normal:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
app.route('/login')
|
app.route('/login')
|
||||||
@ -31,44 +31,70 @@ app.route('/login')
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
Submit your page when you think you've got it right. If you're running into errors, you can check out the project up to this point [here](https://gist.github.com/camperbot/1f7f6f76adb178680246989612bea21e).
|
Envía tu página cuando creas que lo has hecho bien. Si te encuentras con errores, puedes revisar el proyecto completado hasta este punto [aquí](https://gist.github.com/camperbot/1f7f6f76adb178680246989612bea21e).
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
Route /auth/github should be correct.
|
La ruta `/auth/github` debe ser correcta.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
(getUserInput) =>
|
async (getUserInput) => {
|
||||||
$.get(getUserInput('url') + '/_api/routes.js').then(
|
try {
|
||||||
(data) => {
|
const res = await fetch(getUserInput('url') + '/_api/routes.js');
|
||||||
|
if (res.ok) {
|
||||||
|
const data = await res.text();
|
||||||
assert.match(
|
assert.match(
|
||||||
data.replace(/\s/g, ''),
|
data.replace(/\s/g, ''),
|
||||||
/('|")\/auth\/github\/?\1[^]*?get.*?passport.authenticate.*?github/gi,
|
/passport.authenticate.*?github/g,
|
||||||
'Route auth/github should only call passport.authenticate with github'
|
'Route auth/github should only call passport.authenticate with github'
|
||||||
);
|
);
|
||||||
},
|
} else {
|
||||||
(xhr) => {
|
throw new Error(res.statusText);
|
||||||
throw new Error(xhr.statusText);
|
|
||||||
}
|
}
|
||||||
);
|
const res2 = await fetch(getUserInput('url') + '/_api/app-stack');
|
||||||
|
if (res2.ok) {
|
||||||
|
const data2 = JSON.parse(await res2.json());
|
||||||
|
const dataLayer = data2.find(layer => layer?.route?.path === '/auth/github');
|
||||||
|
assert.deepInclude(dataLayer?.route, { methods: {get: true}, path: "/auth/github"});
|
||||||
|
assert.deepInclude(dataLayer?.route?.stack?.[0], {method: "get", name: "authenticate"});
|
||||||
|
} else {
|
||||||
|
throw new Error(res2.statusText);
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
throw new Error(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Route /auth/github/callback should be correct.
|
La ruta `/auth/github/callback` debe ser correcta.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
(getUserInput) =>
|
async (getUserInput) => {
|
||||||
$.get(getUserInput('url') + '/_api/routes.js').then(
|
try {
|
||||||
(data) => {
|
const res = await fetch(getUserInput('url') + '/_api/routes.js');
|
||||||
|
if (res.ok) {
|
||||||
|
const data = await res.text();
|
||||||
assert.match(
|
assert.match(
|
||||||
data.replace(/\s/g, ''),
|
data.replace(/\s/g, ''),
|
||||||
/('|")\/auth\/github\/callback\/?\1[^]*?get.*?passport.authenticate.*?github.*?failureRedirect:("|')\/\2/gi,
|
/failureRedirect:("|')\/\1/g,
|
||||||
'Route auth/github/callback should accept a get request and call passport.authenticate for github with a failure redirect to home'
|
'Route auth/github/callback should accept a get request and call passport.authenticate for github with a failure redirect to home'
|
||||||
);
|
);
|
||||||
},
|
} else {
|
||||||
(xhr) => {
|
throw new Error(res.statusText);
|
||||||
throw new Error(xhr.statusText);
|
|
||||||
}
|
}
|
||||||
);
|
const res2 = await fetch(getUserInput('url') + '/_api/app-stack');
|
||||||
|
if (res2.ok) {
|
||||||
|
const data2 = JSON.parse(await res2.json());
|
||||||
|
const dataLayer = data2.find(layer => layer?.route?.path === '/auth/github/callback');
|
||||||
|
assert.deepInclude(dataLayer?.route, { methods: {get: true}, path: "/auth/github/callback"});
|
||||||
|
assert.deepInclude(dataLayer?.route?.stack?.[0], {method: "get", name: "authenticate"});
|
||||||
|
} else {
|
||||||
|
throw new Error(res2.statusText);
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
throw new Error(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -9,22 +9,74 @@ dashedName: port-scanner
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
|
Você [trabalhará neste projeto com nosso código inicial do Replit](https://replit.com/github/freeCodeCamp/boilerplate-port-scanner).
|
||||||
|
|
||||||
|
Ainda estamos desenvolvendo a parte instrucional interativa do currículo Python. Por enquanto, aqui estão alguns vídeos no canal do freeCodeCamp.org do YouTube que ensinarão tudo o que você precisa saber para completar este projeto:
|
||||||
|
|
||||||
|
- [Curso de Python em vídeo para todos](https://www.freecodecamp.org/news/python-for-everybody/) (14 horas)
|
||||||
|
|
||||||
|
- [Curso Aprenda Python em vídeo](https://www.freecodecamp.org/news/learn-python-video-course/) (10 horas)
|
||||||
|
|
||||||
|
# --instructions--
|
||||||
|
|
||||||
Crie um scanner de portas usando Python.
|
Crie um scanner de portas usando Python.
|
||||||
|
|
||||||
Você pode acessar [a descrição completa do projeto e o código inicial no Replit](https://replit.com/github/freeCodeCamp/boilerplate-port-scanner).
|
No arquivo `port_scanner.py`, crie uma função chamada `get_open_ports` que recebe um argumento `target` e um argumento `port_range`. `target` pode ser um URL ou um endereço IP. `port_range` é uma lista de dois números indicando o primeiro e último números do intervalo de portas a serem verificadas.
|
||||||
|
|
||||||
Depois de ir para esse link, faça fork no projeto. Depois que você completar o projeto com base nas instruções do 'README.md', envie o link do seu projeto abaixo.
|
Aqui estão exemplos de como a função pode ser chamada:
|
||||||
|
|
||||||
Ainda estamos desenvolvendo a parte instrucional interativa do currículo Python. Por enquanto, aqui estão alguns vídeos no canal do freeCodeCamp.org do YouTube que ensinarão um pouco sobre as habilidades em Python de que você precisa este projeto:
|
```py
|
||||||
|
get_open_ports("209.216.230.240", [440, 445])
|
||||||
|
get_open_ports("www.stackoverflow.com", [79, 82])
|
||||||
|
```
|
||||||
|
|
||||||
<ul>
|
A função deve retornar uma lista de portas abertas no intervalo informado.
|
||||||
<li>
|
|
||||||
<a href='https://www.freecodecamp.org/news/python-for-everybody/'>Curso de Python em vídeo para todos</a> (14 horas)
|
A função `get_open_ports` também deve receber um terceiro argumento opcional `True` para indicar o modo "Verbose". Se definido como True, a função deve retornar uma string descritiva ao invés de uma lista de portas.
|
||||||
</li>
|
|
||||||
<li>
|
Aqui está o formato da string que deve ser retornada no modo Verbose (o texto dentro de `{}` indica a informação que deve aparecer):
|
||||||
<a href='https://www.freecodecamp.org/news/learn-python-basics-in-depth-video-course/'>Curso em vídeo Aprenda Python</a> (2 horas)
|
|
||||||
</li>
|
```bash
|
||||||
</ul>
|
Open ports for {URL} ({IP address})
|
||||||
|
PORT SERVICE
|
||||||
|
{port} {service name}
|
||||||
|
{port} {service name}
|
||||||
|
```
|
||||||
|
|
||||||
|
Você pode usar o dicionário em `common_ports.py` para obter o nome de serviço correto para cada porta.
|
||||||
|
|
||||||
|
Por exemplo, se a função é chamada assim:
|
||||||
|
|
||||||
|
```py
|
||||||
|
port_scanner.get_open_ports("scanme.nmap.org", [20, 80], True)
|
||||||
|
```
|
||||||
|
|
||||||
|
Ela deve devolver o seguinte:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
Open ports for scanme.nmap.org (45.33.32.156)
|
||||||
|
PORT SERVICE
|
||||||
|
22 ssh
|
||||||
|
80 http
|
||||||
|
```
|
||||||
|
|
||||||
|
Certifique-se de incluir o espaçamento adequado e caracteres de nova linha.
|
||||||
|
|
||||||
|
Se o URL passado para a função `get_open_ports` for inválido, a função deve retornar a string: "Error: Invalid hostname".
|
||||||
|
|
||||||
|
Se o endereço IP passado para a função `get_open_ports` for inválido, a função deve retornar a string: "Error: Invalid IP address".
|
||||||
|
|
||||||
|
## Desenvolvimento
|
||||||
|
|
||||||
|
Escreva seu código em `port_scanner.py`. Para o desenvolvimento, você pode usar `main.py` para testar seu código. Clique no botão "Run" e `main.py` será executado.
|
||||||
|
|
||||||
|
## Testes
|
||||||
|
|
||||||
|
Os testes unitários para este projeto estão em `test_module.py`. Importamos os testes de `test_module.py` em `main.py` para a sua conveniência. Os testes serão executados automaticamente sempre que você clicar no botão "Run".
|
||||||
|
|
||||||
|
## Envio
|
||||||
|
|
||||||
|
Copie o URL do seu projeto e envie-o para o freeCodeCamp.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
|
@ -9,22 +9,51 @@ dashedName: sha-1-password-cracker
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
|
Você [trabalhará neste projeto com nosso código inicial do Replit](https://replit.com/github/freeCodeCamp/boilerplate-SHA-1-password-cracker).
|
||||||
|
|
||||||
|
Ainda estamos desenvolvendo a parte instrucional interativa do currículo Python. Por enquanto, aqui estão alguns vídeos no canal do freeCodeCamp.org do YouTube que ensinarão tudo o que você precisa saber para completar este projeto:
|
||||||
|
|
||||||
|
- [Curso de Python em vídeo para todos](https://www.freecodecamp.org/news/python-for-everybody/) (14 horas)
|
||||||
|
|
||||||
|
- [Curso Aprenda Python em vídeo](https://www.freecodecamp.org/news/learn-python-video-course/) (10 horas)
|
||||||
|
|
||||||
|
# --instructions--
|
||||||
|
|
||||||
|
As senhas nunca devem ser armazenadas em texto simples. Elas devem ser armazenadas como hashes, para o caso de a lista de senhas ser descoberta. No entanto, nem todas as hashes são criadas da mesma forma.
|
||||||
|
|
||||||
Para este projeto, você vai aprender sobre a importância de boa segurança criando um cracker de senha para descobrir senhas que passaram por hashing usando SHA-1.
|
Para este projeto, você vai aprender sobre a importância de boa segurança criando um cracker de senha para descobrir senhas que passaram por hashing usando SHA-1.
|
||||||
|
|
||||||
Você pode acessar [a descrição completa do projeto e o código inicial no Replit](https://replit.com/github/freeCodeCamp/boilerplate-SHA-1-password-cracker).
|
Crie uma função que receba um hash SHA-1 de uma senha e retorne a senha se for uma das 10.000 senhas mais usadas. Se o hash SHA-1 NÃO for o de uma senha no banco de dados, retorne "PASSWORD NOT IN DATABASE".
|
||||||
|
|
||||||
Depois de ir para esse link, faça fork no projeto. Depois que você completar o projeto com base nas instruções do 'README.md', envie o link do seu projeto abaixo.
|
A função deve fazer o hash cada senha de `top-10000-passwords.txt` e compará-la ao hash passado pela função.
|
||||||
|
|
||||||
Ainda estamos desenvolvendo a parte instrucional interativa do currículo Python. Por enquanto, aqui estão alguns vídeos no canal do freeCodeCamp.org do YouTube que ensinarão um pouco sobre as habilidades em Python de que você precisa este projeto:
|
A função deve receber um segundo argumento opcional chamado `use_salts`. Se definido como True, cada string de salt do arquivo `known-salts.txt` deve ser anexada E pré-incluída em cada senha de `top-10000-passwords.txt` antes de fazer o hashing e antes de compará-la com o hash passado pela função.
|
||||||
|
|
||||||
<ul>
|
Aqui estão algumas senhas com hash para testar a função:
|
||||||
<li>
|
|
||||||
<a href='https://www.freecodecamp.org/news/python-for-everybody/'>Curso de Python em vídeo para todos</a> (14 horas)
|
- `b305921a3723cd5d70a375cd21a61e60aabb84ec` deve retornar "sammy123"
|
||||||
</li>
|
- `c7ab388a5ebefbf4d550652f1eb4d833e5316e3e` deve retornar "abacab"
|
||||||
<li>
|
- `5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8` deve retornar "password"
|
||||||
<a href='https://www.freecodecamp.org/news/learn-python-basics-in-depth-video-course/'>Curso em vídeo Aprenda Python</a> (2 horas)
|
|
||||||
</li>
|
Aqui estão algumas senhas com hash para testar a função quando `use_salts` for definido como `True`:
|
||||||
</ul>
|
|
||||||
|
- `53d8b3dc9d39f0184144674e310185e41a87ffd5` deve retornar "superman"
|
||||||
|
- `da5a4e8cf89539e66097acd2f8af128acae2f8ae` deve retornar "q1w2e3r4t5"
|
||||||
|
- `ea3f62d498e3b98557f9f9cd0d905028b3b019e1` deve retornar "bubbles1"
|
||||||
|
|
||||||
|
A biblioteca `hashlib` foi importada para você. Sugerimos que você a use no seu código. [Siaba mais sobre a "hashlib" aqui.](https://docs.python.org/3/library/hashlib.html)
|
||||||
|
|
||||||
|
## Desenvolvimento
|
||||||
|
|
||||||
|
Escreva seu código em `password_cracker.py`. Para o desenvolvimento, você pode usar `main.py` para testar seu código. Clique no botão "Run" e `main.py` será executado.
|
||||||
|
|
||||||
|
## Testes
|
||||||
|
|
||||||
|
Os testes unitários para este projeto estão em `test_module.py`. Importamos os testes de `test_module.py` em `main.py` para a sua conveniência. Os testes serão executados automaticamente sempre que você clicar no botão "Run".
|
||||||
|
|
||||||
|
## Envio
|
||||||
|
|
||||||
|
Copie o URL do seu projeto e envie-o para o freeCodeCamp.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
|
@ -12,9 +12,9 @@ A sequência de Fibonacci é definida pela relação de recorrência:
|
|||||||
|
|
||||||
$F_n = F_{n − 1} + F_{n − 2}$, onde $F_1 = 1$ e $F_2 = 1$
|
$F_n = F_{n − 1} + F_{n − 2}$, onde $F_1 = 1$ e $F_2 = 1$
|
||||||
|
|
||||||
$F_{541} $, que contém 113 dígitos, é o primeiro número de Fibonacci para o qual os últimos nove dígitos são de 1a 9 pandigital (contém todos os dígitos de 1 a 9, mas não necessariamente em ordem). E $F_{2749}$, que contém 575 dígitos, é o primeiro número de Fibonacci para o qual os primeiros nove dígitos são 1 - 9 pandigital.
|
$F_{541} $, que contém 113 algarismos, é o primeiro número de Fibonacci para o qual os últimos nove algarismos são de 1a 9 pandigital (contém todos os algarismos de 1 a 9, mas não necessariamente em ordem). E $F_{2749}$, que contém 575 algarismos, é o primeiro número de Fibonacci para o qual os primeiros nove algarismos são 1 - 9 pandigital.
|
||||||
|
|
||||||
Dado que $F_k$ é o primeiro número de Fibonacci para o qual os primeiros nove dígitos E os últimos nove dígitos são de 1 a 9 pandigital, encontre `k`.
|
Dado que $F_k$ é o primeiro número de Fibonacci para o qual os primeiros nove algarismos E os últimos nove algarismos são de 1 a 9 pandigital, encontre `k`.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
|
@ -8,28 +8,28 @@ dashedName: problem-111-primes-with-runs
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Considerando primos de 4 algarismos contendo dígitos repetidos, é claro que eles não podem ser todos iguais: 1111 é divisível por 11, 2222 é divisível por 22, e assim por diante. Mas há nove primos de 4 algarismos que contêm três números 1:
|
Considerando primos de 4 algarismos contendo algarismos repetidos, é claro que eles não podem ser todos iguais: 1111 é divisível por 11, 2222 é divisível por 22, e assim por diante. Mas há nove primos de 4 algarismos que contêm três números 1:
|
||||||
|
|
||||||
$$1117, 1151, 1171, 1181, 1511, 1811, 2111, 4111, 8111$$
|
$$1117, 1151, 1171, 1181, 1511, 1811, 2111, 4111, 8111$$
|
||||||
|
|
||||||
Vamos dizer que $M(n, d)$ representa o número máximo de dígitos repetidos para um primo de n algarismos, onde d é o dígito repetido, $N(n, d)$ representa quantos desses primos existem, e $S(n, d)$ representa a soma desses primos.
|
Vamos dizer que $M(n, d)$ representa o número máximo de algarismos repetidos para um primo de n algarismos, onde d é o algarismo repetido, $N(n, d)$ representa quantos desses primos existem, e $S(n, d)$ representa a soma desses primos.
|
||||||
|
|
||||||
Então $M(4, 1) = 3$ é o número máximo de dígitos repetidos para um primo de 4 algarismos, onde 1 é o dígito repetido, há $N(4, 1) = 9$ primos desses, e a soma desses primos é $S(4, 1) = 22275$. Acontece que, para d = 0, só é possível ter $M(4, 0) = 2$ dígitos repetidos, mas há $N(4, 0) = 13$ desses casos.
|
Então $M(4, 1) = 3$ é o número máximo de algarismos repetidos para um primo de 4 algarismos, onde 1 é o algarismo repetido, há $N(4, 1) = 9$ primos desses, e a soma desses primos é $S(4, 1) = 22275$. Acontece que, para d = 0, só é possível ter $M(4, 0) = 2$ algarismos repetidos, mas há $N(4, 0) = 13$ desses casos.
|
||||||
|
|
||||||
Da mesma forma, obtemos os seguintes resultados para primos de 4 algarismos.
|
Da mesma forma, obtemos os seguintes resultados para primos de 4 algarismos.
|
||||||
|
|
||||||
| Dígito, d | $M(4, d)$ | $N(4, d)$ | $S(4, d)$ |
|
| Algarismo, d | $M(4, d)$ | $N(4, d)$ | $S(4, d)$ |
|
||||||
| --------- | --------- | --------- | --------- |
|
| ------------ | --------- | --------- | --------- |
|
||||||
| 0 | 2 | 13 | 67061 |
|
| 0 | 2 | 13 | 67061 |
|
||||||
| 1 | 3 | 9 | 22275 |
|
| 1 | 3 | 9 | 22275 |
|
||||||
| 2 | 3 | 1 | 2221 |
|
| 2 | 3 | 1 | 2221 |
|
||||||
| 3 | 3 | 12 | 46214 |
|
| 3 | 3 | 12 | 46214 |
|
||||||
| 4 | 3 | 2 | 8888 |
|
| 4 | 3 | 2 | 8888 |
|
||||||
| 5 | 3 | 1 | 5557 |
|
| 5 | 3 | 1 | 5557 |
|
||||||
| 6 | 3 | 1 | 6661 |
|
| 6 | 3 | 1 | 6661 |
|
||||||
| 7 | 3 | 9 | 57863 |
|
| 7 | 3 | 9 | 57863 |
|
||||||
| 8 | 3 | 1 | 8887 |
|
| 8 | 3 | 1 | 8887 |
|
||||||
| 9 | 3 | 7 | 48073 |
|
| 9 | 3 | 7 | 48073 |
|
||||||
|
|
||||||
Para d = 0 até 9, a soma de todos $S(4, d)$ é 273700. Calcule a soma de todos os $S(10, d)$.
|
Para d = 0 até 9, a soma de todos $S(4, d)$ é 273700. Calcule a soma de todos os $S(10, d)$.
|
||||||
|
|
||||||
|
@ -8,9 +8,9 @@ dashedName: problem-113-non-bouncy-numbers
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Trabalhando da esquerda para a direita, se nenhum dígito for excedido pelo dígito à sua esquerda, é chamado de número crescente. Por exemplo, 134468.
|
Trabalhando da esquerda para a direita, se nenhum algarismo for excedido pelo algarismo à sua esquerda, é chamado de número crescente. Por exemplo, 134468.
|
||||||
|
|
||||||
Da mesma forma, se nenhum dígito for excedido pelo dígito à sua direita, é chamado de número decrescente. Por exemplo, 66420.
|
Da mesma forma, se nenhum algarismo for excedido pelo algarismo à sua direita, é chamado de número decrescente. Por exemplo, 66420.
|
||||||
|
|
||||||
Chamaremos um número inteiro positivo que não aumenta nem diminui um número "saltitante"; por exemplo, 155349.
|
Chamaremos um número inteiro positivo que não aumenta nem diminui um número "saltitante"; por exemplo, 155349.
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ dashedName: problem-118-pandigital-prime-sets
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Usando todos os dígitos de 1 a 9 e concatenando-os livremente para formar números inteiros decimais, diferentes conjuntos podem ser formados. É interessante que, com o conjunto $\\{2, 5, 47, 89, 631\\}$, todos os elementos pertencentes a ele são primos.
|
Usando todos os algarismos de 1 a 9 e concatenando-os livremente para formar números inteiros decimais, diferentes conjuntos podem ser formados. É interessante que, com o conjunto $\\{2, 5, 47, 89, 631\\}$, todos os elementos pertencentes a ele são primos.
|
||||||
|
|
||||||
Quantos conjuntos distintos, contendo cada um dos algarismos de um a nove exatamente uma vez, são compostos apenas por elementos primos?
|
Quantos conjuntos distintos, contendo cada um dos algarismos de um a nove exatamente uma vez, são compostos apenas por elementos primos?
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f3e41000cf542c50fef6
|
id: 5900f3e41000cf542c50fef6
|
||||||
title: 'Problema 119: Soma das potências dos dígitos'
|
title: 'Problema 119: Soma das potências dos algarismos'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 301745
|
forumTopicId: 301745
|
||||||
dashedName: problem-119-digit-power-sum
|
dashedName: problem-119-digit-power-sum
|
||||||
@ -10,7 +10,7 @@ dashedName: problem-119-digit-power-sum
|
|||||||
|
|
||||||
O número 512 é interessante porque é igual à soma de seus algarismos elevado a alguma potência: $5 + 1 + 2 = 8$, e $8^3 = 512$. Outro exemplo de um número com essa propriedade é $614656 = 28^4$.
|
O número 512 é interessante porque é igual à soma de seus algarismos elevado a alguma potência: $5 + 1 + 2 = 8$, e $8^3 = 512$. Outro exemplo de um número com essa propriedade é $614656 = 28^4$.
|
||||||
|
|
||||||
Vamos definir $a_n$ como o $n-ésimo$ termo desta sequência e reforçar que um número deve conter pelo menos dois dígitos para ter uma soma.
|
Vamos definir $a_n$ como o $n-ésimo$ termo desta sequência e reforçar que um número deve conter pelo menos dois algarismos para ter uma soma.
|
||||||
|
|
||||||
Você já sabe que $a_2 = 512$ e $a_{10} = 614656$.
|
Você já sabe que $a_2 = 512$ e $a_{10} = 614656$.
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ dashedName: problem-13-large-sum
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Abaixo está um número de 150 dígitos. Após somar este número, retorne os 10 primeiros dígitos.
|
Abaixo está um número de 150 algarismos. Após somar este número, retorne os 10 primeiros algarismos.
|
||||||
|
|
||||||
<div style='padding-left: 4em;'>
|
<div style='padding-left: 4em;'>
|
||||||
37107287533902102798797998220837590246510135740250<br>
|
37107287533902102798797998220837590246510135740250<br>
|
||||||
|
@ -8,7 +8,7 @@ dashedName: problem-145-how-many-reversible-numbers-are-there-below-one-billion
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Alguns números inteiros positivos $n$ têm a propriedade de que a soma [ $n + reverse(n)$ ] consiste inteiramente de dígitos ímpares (decimais). Por exemplo, $36 + 63 = 99$ e $409 + 904 = 1313$. Chamaremos esses números de reversíveis. Portanto, 36, 63, 409 e 904 são reversíveis. Zeros à esquerda não são permitidos em $n$ ou em $reverse(n)$.
|
Alguns números inteiros positivos $n$ têm a propriedade de que a soma [ $n + reverse(n)$ ] consiste inteiramente de algarismos ímpares (decimais). Por exemplo, $36 + 63 = 99$ e $409 + 904 = 1313$. Chamaremos esses números de reversíveis. Portanto, 36, 63, 409 e 904 são reversíveis. Zeros à esquerda não são permitidos em $n$ ou em $reverse(n)$.
|
||||||
|
|
||||||
Há 120 números reversíveis abaixo de mil.
|
Há 120 números reversíveis abaixo de mil.
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ dashedName: problem-160-factorial-trailing-digits
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Para qualquer $N$, considere $f(N)$ como os últimos cinco dígitos antes dos zeros à direita em $N!$.
|
Para qualquer $N$, considere $f(N)$ como os últimos cinco algarismos antes dos zeros à direita em $N!$.
|
||||||
|
|
||||||
Por exemplo:
|
Por exemplo:
|
||||||
|
|
||||||
|
@ -8,17 +8,17 @@ dashedName: problem-162-hexadecimal-numbers
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Os números do sistema de números hexadecimais são representados usando 16 dígitos diferentes:
|
Os números do sistema de números hexadecimais são representados usando 16 algarismos diferentes:
|
||||||
|
|
||||||
$$0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F$$
|
$$0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F$$
|
||||||
|
|
||||||
O número hexadecimal AF quando escrito no sistema de números decimais é igual a $10 \times 16 + 15 = 175$.
|
O número hexadecimal AF quando escrito no sistema de números decimais é igual a $10 \times 16 + 15 = 175$.
|
||||||
|
|
||||||
Nos números hexadecimais de 3 dígitos 10A, 1A0, A10 e A01 os algarismos 0,1 e A estão todos presentes.
|
Nos números hexadecimais de 3 algarismos 10A, 1A0, A10 e A01, os algarismos 0,1 e A estão todos presentes.
|
||||||
|
|
||||||
Como números escritos na base dez, escrevemos números hexadecimais sem zeros à frente.
|
Como números escritos na base dez, escrevemos números hexadecimais sem zeros à frente.
|
||||||
|
|
||||||
Quantos números hexadecimais, contendo no máximo dezesseis dígitos hexadecimais, existem com os dígitos 0,1 e A presentes pelo menos uma vez?
|
Quantos números hexadecimais, contendo no máximo dezesseis algarismos hexadecimais, existem com os algarismos 0,1 e A presentes pelo menos uma vez?
|
||||||
|
|
||||||
Dê sua resposta com um número hexadecimal como uma string.
|
Dê sua resposta com um número hexadecimal como uma string.
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ $$\begin{array}{} 6 & 3 & 3 & 0 \\\\ 5 & 0 & 4 & 3 \\\\ 0 & 7 & 1 & 4 \\\\ 1 & 2
|
|||||||
|
|
||||||
a soma de cada linha e de cada coluna tem o valor 12. Além disso, a soma de cada diagonal também é 12.
|
a soma de cada linha e de cada coluna tem o valor 12. Além disso, a soma de cada diagonal também é 12.
|
||||||
|
|
||||||
De quantas maneiras você pode preencher uma grade 4x4 com os dígitos $d$, sendo que $0 ≤ d ≤ 9$, de modo que cada linha, cada coluna e as duas diagonais tenham a mesma soma?
|
De quantas maneiras você pode preencher uma grade 4x4 com os algarismos $d$, sendo que $0 ≤ d ≤ 9$, de modo que cada linha, cada coluna e as duas diagonais tenham a mesma soma?
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ Pode-se ver que $714285 = 5 × 142857$.
|
|||||||
|
|
||||||
Isto demonstra uma propriedade incomum de 142857: ele é um divisor de sua rotação à direita.
|
Isto demonstra uma propriedade incomum de 142857: ele é um divisor de sua rotação à direita.
|
||||||
|
|
||||||
Encontre os últimos 5 dígitos da soma de todos os números inteiros $n$, sendo que $10 < n < 10100$, que têm essa propriedade.
|
Encontre os últimos 5 algarismos da soma de todos os números inteiros $n$, sendo que $10 < n < 10100$, que têm essa propriedade.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ Para um número inteiro positivo $n$, considere $f(n)$ como a soma dos quadrados
|
|||||||
|
|
||||||
$$\begin{align} & f(3) = 3^2 = 9 \\\\ & f(25) = 2^2 + 5^2 = 4 + 25 = 29 \\\\ & f(442) = 4^2 + 4^2 + 2^2 = 16 + 16 + 4 = 36 \\\\ \end{align}$$
|
$$\begin{align} & f(3) = 3^2 = 9 \\\\ & f(25) = 2^2 + 5^2 = 4 + 25 = 29 \\\\ & f(442) = 4^2 + 4^2 + 2^2 = 16 + 16 + 4 = 36 \\\\ \end{align}$$
|
||||||
|
|
||||||
Encontre os últimos nove dígitos da soma de todos os $n$, sendo que $0 < n < {10}^{20}$, de modo que $f(n)$ seja um quadrado perfeito.
|
Encontre os últimos nove algarismos da soma de todos os $n$, sendo que $0 < n < {10}^{20}$, de modo que $f(n)$ seja um quadrado perfeito.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f4181000cf542c50ff2b
|
id: 5900f4181000cf542c50ff2b
|
||||||
title: 'Problema 172: Investigação dos números com poucos dígitos repetidos'
|
title: 'Problema 172: Investigação dos números com poucos algarismos repetidos'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 301807
|
forumTopicId: 301807
|
||||||
dashedName: problem-172-investigating-numbers-with-few-repeated-digits
|
dashedName: problem-172-investigating-numbers-with-few-repeated-digits
|
||||||
|
@ -22,7 +22,7 @@ Com base nos palpites abaixo
|
|||||||
|
|
||||||
$$\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}$$
|
$$\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}$$
|
||||||
|
|
||||||
Encontre a sequência secreta única de 16 dígitos.
|
Encontre a sequência secreta única de 16 algarismos.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ Uma configuração do tipo $(a,b,c)$ é um gráfico que faz parte de $a$ unidade
|
|||||||
|
|
||||||
Considere $N(a,b,c)$ o número de configurações do tipo $(a,b,c)$. Por exemplo, $N(1,0,3) = 24$, $N(0,2,4) = 92928$ e $N(2,2,3) = 20736$.
|
Considere $N(a,b,c)$ o número de configurações do tipo $(a,b,c)$. Por exemplo, $N(1,0,3) = 24$, $N(0,2,4) = 92928$ e $N(2,2,3) = 20736$.
|
||||||
|
|
||||||
Encontre os últimos 8 dígitos de $N(25,75,1984)$.
|
Encontre os últimos 8 algarismos de $N(25,75,1984)$.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ dashedName: problem-20-factorial-digit-sum
|
|||||||
`n`! significa `n` × (`n` - 1) × ... × 3 × 2 × 1
|
`n`! significa `n` × (`n` - 1) × ... × 3 × 2 × 1
|
||||||
|
|
||||||
Por exemplo: 10! = 10 × 9 × ... × 3 × 2 × 1 = 3628800.
|
Por exemplo: 10! = 10 × 9 × ... × 3 × 2 × 1 = 3628800.
|
||||||
E a soma dos dígitos no número 10! é 3 + 6 + 2 + 8 + 8 + 0 + 0 + 0 = 27.
|
E a soma dos algarismos no número 10! é 3 + 6 + 2 + 8 + 8 + 0 + 0 + 0 = 27.
|
||||||
|
|
||||||
Encontre a soma dos algarismos de `n`!
|
Encontre a soma dos algarismos de `n`!
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ dashedName: problem-209-circular-logic
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Uma tabela verdade binária de $k$ entradas é um mapa de $k$ bits de entrada (dígitos binários, 0 [false] ou 1 [true]) para 1 bit de saída. Por exemplo, as tabelas verdade binárias de $2$ entradas para as funções lógicas de $AND$ e $XOR$ são:
|
Uma tabela verdade binária de $k$ entradas é um mapa de $k$ bits de entrada (algarismos binários, 0 [false] ou 1 [true]) para 1 bit de saída. Por exemplo, as tabelas verdade binárias de $2$ entradas para as funções lógicas de $AND$ e $XOR$ são:
|
||||||
|
|
||||||
| x | y | x AND y |
|
| x | y | x AND y |
|
||||||
| - | - | ------- |
|
| - | - | ------- |
|
||||||
|
@ -12,7 +12,7 @@ Uma permutação consiste de elementos que podem formar agrupamentos que se dife
|
|||||||
|
|
||||||
<div style='text-align: center;'>012 021 102 120 201 210</div>
|
<div style='text-align: center;'>012 021 102 120 201 210</div>
|
||||||
|
|
||||||
Qual é a `n`-ésima permutação lexicográfica dos dígitos 0, 1, 2, 3, 4, 5, 6, 7, 8 e 9?
|
Qual é a `n`-ésima permutação lexicográfica dos algarismos 0, 1, 2, 3, 4, 5, 6, 7, 8 e 9?
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f3851000cf542c50fe98
|
id: 5900f3851000cf542c50fe98
|
||||||
title: 'Problema 25: Número Fibonacci de 1000 dígitos'
|
title: 'Problema 25: Número Fibonacci de 1000 algarismos'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 301897
|
forumTopicId: 301897
|
||||||
dashedName: problem-25-1000-digit-fibonacci-number
|
dashedName: problem-25-1000-digit-fibonacci-number
|
||||||
@ -16,9 +16,9 @@ Portanto, os primeiros 12 termos serão:
|
|||||||
|
|
||||||
<div style='padding-left: 4em; display: inline-grid; grid-template-rows: auto; row-gap: 7px;'><div>F<sub>1</sub> = 1</div><div>F<sub>2</sub> = 1</div><div>F<sub>3</sub> = 2</div><div>F<sub>4</sub> = 3</div><div>F<sub>5</sub> = 5</div><div>F<sub>6</sub> = 8</div><div>F<sub>7</sub> = 13</div><div>F<sub>8</sub> = 21</div><div>F<sub>9</sub> = 34</div><div>F<sub>10</sub> = 55</div><div>F<sub>11</sub> = 89</div><div>F<sub>12</sub> = 144</div></div>
|
<div style='padding-left: 4em; display: inline-grid; grid-template-rows: auto; row-gap: 7px;'><div>F<sub>1</sub> = 1</div><div>F<sub>2</sub> = 1</div><div>F<sub>3</sub> = 2</div><div>F<sub>4</sub> = 3</div><div>F<sub>5</sub> = 5</div><div>F<sub>6</sub> = 8</div><div>F<sub>7</sub> = 13</div><div>F<sub>8</sub> = 21</div><div>F<sub>9</sub> = 34</div><div>F<sub>10</sub> = 55</div><div>F<sub>11</sub> = 89</div><div>F<sub>12</sub> = 144</div></div>
|
||||||
|
|
||||||
O 12º termo, F<sub>12</sub>, é o primeiro termo a conter três dígitos.
|
O 12º termo, F<sub>12</sub>, é o primeiro termo a conter três algarismos.
|
||||||
|
|
||||||
Qual é o índice do primeiro termo na sequência de Fibonacci a conter `n` dígitos?
|
Qual é o índice do primeiro termo na sequência de Fibonacci a conter `n` algarismos?
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f46b1000cf542c50ff7d
|
id: 5900f46b1000cf542c50ff7d
|
||||||
title: 'Problema 254: Soma de dígitos fatoriais'
|
title: 'Problema 254: Soma de algarismos fatoriais'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 301902
|
forumTopicId: 301902
|
||||||
dashedName: problem-254-sums-of-digit-factorials
|
dashedName: problem-254-sums-of-digit-factorials
|
||||||
|
@ -26,7 +26,7 @@ até $x_{k + 1} = x_k$.
|
|||||||
|
|
||||||
Como exemplo, vamos encontrar a raiz quadrada arredondada de $n = 4321$.
|
Como exemplo, vamos encontrar a raiz quadrada arredondada de $n = 4321$.
|
||||||
|
|
||||||
$n$ tem 4 dígitos, então $x_0 = 7 × {10}^{\frac{4-2}{2}} = 70$.
|
$n$ tem 4 algarismos, então $x_0 = 7 × {10}^{\frac{4-2}{2}} = 70$.
|
||||||
|
|
||||||
$$x_1 = \left\lfloor\frac{70 + \left\lceil\frac{4321}{70}\right\rceil}{2}\right\rfloor = 66 \\\\ x_2 = \left\lfloor\frac{66 + \left\lceil\frac{4321}{66}\right\rceil}{2}\right\rfloor = 66$$
|
$$x_1 = \left\lfloor\frac{70 + \left\lceil\frac{4321}{70}\right\rceil}{2}\right\rfloor = 66 \\\\ x_2 = \left\lfloor\frac{66 + \left\lceil\frac{4321}{66}\right\rceil}{2}\right\rfloor = 66$$
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ Em uma fração unitária, o numerador é 1. A representação decimal das fraç
|
|||||||
|
|
||||||
<div style='padding-left: 4em; display: inline-grid; grid-template-rows: auto; row-gap: 7px;'><div><sup>1</sup>/<sub>2</sub> = 0.5</div><div><sup>1</sup>/<sub>3</sub> = 0.(3)</div><div><sup>1</sup>/<sub>4</sub> = 0.25</div><div><sup>1</sup>/<sub>5</sub> = 0.2</div><div><sup>1</sup>/<sub>6</sub> = 0.1(6)</div><div><sup>1</sup>/<sub>7</sub> = 0.(142857)</div><div><sup>1</sup>/<sub>8</sub> = 0.125</div><div><sup>1</sup>/<sub>9</sub> = 0.(1)</div><div><sup>1</sup>/<sub>10</sub> = 0.1</div></div>
|
<div style='padding-left: 4em; display: inline-grid; grid-template-rows: auto; row-gap: 7px;'><div><sup>1</sup>/<sub>2</sub> = 0.5</div><div><sup>1</sup>/<sub>3</sub> = 0.(3)</div><div><sup>1</sup>/<sub>4</sub> = 0.25</div><div><sup>1</sup>/<sub>5</sub> = 0.2</div><div><sup>1</sup>/<sub>6</sub> = 0.1(6)</div><div><sup>1</sup>/<sub>7</sub> = 0.(142857)</div><div><sup>1</sup>/<sub>8</sub> = 0.125</div><div><sup>1</sup>/<sub>9</sub> = 0.(1)</div><div><sup>1</sup>/<sub>10</sub> = 0.1</div></div>
|
||||||
|
|
||||||
A expressão 0.1(6) significa 0.16666666... e tem um ciclo recorrente (que se repete) de 1 algarismo. Podemos notar que <sup>1</sup>/<sub>7</sub> tem um ciclo recorrente de 6 dígitos.
|
A expressão 0.1(6) significa 0.16666666... e tem um ciclo recorrente (que se repete) de 1 algarismo. Podemos notar que <sup>1</sup>/<sub>7</sub> tem um ciclo recorrente de 6 algarismos.
|
||||||
|
|
||||||
Calcule o valor de `d` < `n` onde <sup>1</sup>/<sub>d</sub> contém o ciclo recorrente mais longo na parte decimal.
|
Calcule o valor de `d` < `n` onde <sup>1</sup>/<sub>d</sub> contém o ciclo recorrente mais longo na parte decimal.
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ dashedName: problem-29-distinct-powers
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Considere todas as combinações de ab onde 2 ≤ a ≤ 5 e 2 ≤ b ≤ 5:
|
Considere todas as combinações de números inteiros de $a^b$ para 2 ≤ a ≤ 5 e 2 ≤ b ≤ 5:
|
||||||
|
|
||||||
<div style='padding-left: 4em;'>
|
<div style='padding-left: 4em;'>
|
||||||
2<sup>2</sup>=4, 2<sup>3</sup>=8, 2<sup>4</sup>=16, 2<sup>5</sup>=32 <br>
|
2<sup>2</sup>=4, 2<sup>3</sup>=8, 2<sup>4</sup>=16, 2<sup>5</sup>=32 <br>
|
||||||
@ -23,7 +23,7 @@ Se eles forem colocados em ordem numérica, com quaisquer repetições removidas
|
|||||||
4, 8, 9, 16, 25, 27, 32, 64, 81, 125, 243, 256, 625, 1024, 3125
|
4, 8, 9, 16, 25, 27, 32, 64, 81, 125, 243, 256, 625, 1024, 3125
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
Quantos termos distintos existem na sequência `ab` onde 2 ≤ `a` ≤ `n` and 2 ≤ `b` ≤ `n`?
|
Quantos termos distintos estão na sequência gerada por $a^b$ para 2 ≤ `a` ≤ `n` e 2 ≤ `b` ≤ `n`?
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ dashedName: problem-30-digit-n-powers
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Surpreendentemente, há apenas três números que são iguais à soma de seus dígitos elevados a 4:
|
Surpreendentemente, há apenas três números que são iguais à soma de seus algarismos elevados a 4:
|
||||||
|
|
||||||
<div style='margin-left: 4em;'>
|
<div style='margin-left: 4em;'>
|
||||||
1634 = 1<sup>4</sup> + 6<sup>4</sup> + 3<sup>4</sup> + 4<sup>4</sup><br>
|
1634 = 1<sup>4</sup> + 6<sup>4</sup> + 3<sup>4</sup> + 4<sup>4</sup><br>
|
||||||
@ -20,7 +20,7 @@ Como 1 = 1<sup>4</sup> não é uma soma, ele não deve ser incluído.
|
|||||||
|
|
||||||
A soma destes números é 1634 + 8208 + 9474 = 19316.
|
A soma destes números é 1634 + 8208 + 9474 = 19316.
|
||||||
|
|
||||||
Encontre a soma de todos os números que são iguais à soma de seus dígitos elevados a `n`.
|
Encontre a soma de todos os números que são iguais à soma de seus algarismos elevados a `n`.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ dashedName: problem-32-pandigital-products
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Dizemos que um número de `n` algarismos é pandigital se ele usar todos os dígitos de 1 a `n` uma única vez. Por exemplo, o número 15234 é pandigital pois possui 5 algarismos e utiliza todos os algarismos entre 1 e 5.
|
Dizemos que um número de `n` algarismos é pandigital se ele usar todos os algarismos de 1 a `n` uma única vez. Por exemplo, o número 15234 é pandigital pois possui 5 algarismos e utiliza todos os algarismos entre 1 e 5.
|
||||||
|
|
||||||
Considere o produto 39 x 186 = 7254. O multiplicando (39), multiplicador (186) e o produto (7254) possuem, no total, nove algarismos e nenhum deles se repetem.
|
Considere o produto 39 x 186 = 7254. O multiplicando (39), multiplicador (186) e o produto (7254) possuem, no total, nove algarismos e nenhum deles se repetem.
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f38d1000cf542c50fea0
|
id: 5900f38d1000cf542c50fea0
|
||||||
title: 'Problema 33: Frações com cancelamento de dígitos'
|
title: 'Problema 33: Frações com cancelamento de algarismos'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 301987
|
forumTopicId: 301987
|
||||||
dashedName: problem-33-digit-cancelling-fractions
|
dashedName: problem-33-digit-cancelling-fractions
|
||||||
@ -8,11 +8,11 @@ dashedName: problem-33-digit-cancelling-fractions
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
A fração <sup>49</sup>/<sub>98</sub> é uma fração curiosa, já que um matemático inexperiente, na tentativa de simplificá-la, pode acreditar, erroneamente, que <sup>49</sup>/<sub>98</sub> = <sup>4</sup>/<sub>8</sub> pelo cancelamento dos dígitos 9. Embora o resultado esteja correto, o raciocínio não está.
|
A fração <sup>49</sup>/<sub>98</sub> é uma fração curiosa, já que um matemático inexperiente, na tentativa de simplificá-la, pode acreditar, erroneamente, que <sup>49</sup>/<sub>98</sub> = <sup>4</sup>/<sub>8</sub> pelo cancelamento dos algarismos 9. Embora o resultado esteja correto, o raciocínio não está.
|
||||||
|
|
||||||
Devemos considerar frações como, por exemplo, <sup>30</sup>/<sub>50</sub> = <sup>3</sup>/<sub>5</sub>, como exemplos triviais.
|
Devemos considerar frações como, por exemplo, <sup>30</sup>/<sub>50</sub> = <sup>3</sup>/<sub>5</sub>, como exemplos triviais.
|
||||||
|
|
||||||
Existem exatamente quatro exemplos não triviais desse tipo de fração, com resultado inferior a 1 e que contêm dois dígitos no numerador e no denominador.
|
Existem exatamente quatro exemplos não triviais desse tipo de fração, com resultado inferior a 1 e que contêm dois algarismos no numerador e no denominador.
|
||||||
|
|
||||||
Se o produto dessas quatro frações é dado por seus mínimos divisores comuns, encontre o valor do denominador.
|
Se o produto dessas quatro frações é dado por seus mínimos divisores comuns, encontre o valor do denominador.
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f38e1000cf542c50fea1
|
id: 5900f38e1000cf542c50fea1
|
||||||
title: 'Problema 34: Dígitos dos fatoriais'
|
title: 'Problema 34: Algarismos dos fatoriais'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 301998
|
forumTopicId: 301998
|
||||||
dashedName: problem-34-digit-factorials
|
dashedName: problem-34-digit-factorials
|
||||||
@ -10,7 +10,7 @@ dashedName: problem-34-digit-factorials
|
|||||||
|
|
||||||
145 é um número curioso, já que 1! + 4! + 5! = 1 + 24 + 120 = 145.
|
145 é um número curioso, já que 1! + 4! + 5! = 1 + 24 + 120 = 145.
|
||||||
|
|
||||||
Calcule os números e a soma dos números que são iguais à soma do fatorial de seus dígitos.
|
Calcule os números e a soma dos números que são iguais à soma do fatorial de seus algarismos.
|
||||||
|
|
||||||
**Observação:** como 1! = 1 e 2! = 2 não são somas, eles não estão incluídos.
|
**Observação:** como 1! = 1 e 2! = 2 não são somas, eles não estão incluídos.
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ dashedName: problem-35-circular-primes
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
O número 197 é chamado de primo circular porque todas as rotações dos dígitos: 197, 971 e 719 formam números primos.
|
O número 197 é chamado de primo circular porque todas as rotações dos algarismos: 197, 971 e 719 formam números primos.
|
||||||
|
|
||||||
Há treze números primos menores que 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79 e 97.
|
Há treze números primos menores que 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79 e 97.
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ O menor número cíclico é o número de 6 algarismos 142857:
|
|||||||
|
|
||||||
$$\begin{align} & 142857 × 1 = 142857 \\\\ & 142857 × 2 = 285714 \\\\ & 142857 × 3 = 428571 \\\\ & 142857 × 4 = 571428 \\\\ & 142857 × 5 = 714285 \\\\ & 142857 × 6 = 857142 \end{align}$$
|
$$\begin{align} & 142857 × 1 = 142857 \\\\ & 142857 × 2 = 285714 \\\\ & 142857 × 3 = 428571 \\\\ & 142857 × 4 = 571428 \\\\ & 142857 × 5 = 714285 \\\\ & 142857 × 6 = 857142 \end{align}$$
|
||||||
|
|
||||||
O próximo número cíclico é 0588235294117647, com 16 dígitos:
|
O próximo número cíclico é 0588235294117647, com 16 algarismos:
|
||||||
|
|
||||||
$$\begin{align} & 0588235294117647 × 1 = 0588235294117647 \\\\ & 0588235294117647 × 2 = 1176470588235294 \\\\ & 0588235294117647 × 3 = 1764705882352941 \\\\ & \ldots \\\\ & 0588235294117647 × 16 = 9411764705882352 \end{align}$$
|
$$\begin{align} & 0588235294117647 × 1 = 0588235294117647 \\\\ & 0588235294117647 × 2 = 1176470588235294 \\\\ & 0588235294117647 × 3 = 1764705882352941 \\\\ & \ldots \\\\ & 0588235294117647 × 16 = 9411764705882352 \end{align}$$
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ $$\begin{array}{cr} n & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12
|
|||||||
|
|
||||||
Também podemos verificar que $A_{100} = 3251$ e $A_{1000} = 80.852.364.498$.
|
Também podemos verificar que $A_{100} = 3251$ e $A_{1000} = 80.852.364.498$.
|
||||||
|
|
||||||
Encontre os últimos 9 dígitos de $\displaystyle\sum_{k = 1}^{18} A_{{10}^k}$.
|
Encontre os últimos 9 algarismos de $\displaystyle\sum_{k = 1}^{18} A_{{10}^k}$.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ Considere $dT(n)$ como o número de divisores de $T(n)$. Ex.: $T(7) = 28$ e $dT(
|
|||||||
|
|
||||||
Considere $Tr(n)$ como o número de trios ($i$, $j$, $k$), tal que $1 ≤ i < j < k ≤ n$ e $dT(i) > dT(j) > dT(k)$. $Tr(20) = 14$, $Tr(100) = 5.772$ e $Tr(1000) = 11.174.776$.
|
Considere $Tr(n)$ como o número de trios ($i$, $j$, $k$), tal que $1 ≤ i < j < k ≤ n$ e $dT(i) > dT(j) > dT(k)$. $Tr(20) = 14$, $Tr(100) = 5.772$ e $Tr(1000) = 11.174.776$.
|
||||||
|
|
||||||
Encontre $Tr(60.000.000)$. Dê os últimos 18 dígitos da sua resposta.
|
Encontre $Tr(60.000.000)$. Dê os últimos 18 algarismos da sua resposta.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
|
@ -12,11 +12,11 @@ Pegue o número 192 e multiplique-o por cada um entre 1, 2 e 3:
|
|||||||
|
|
||||||
$$\begin{align} 192 × 1 = 192\\\\ 192 × 2 = 384\\\\ 192 × 3 = 576\\\\ \end{align}$$
|
$$\begin{align} 192 × 1 = 192\\\\ 192 × 2 = 384\\\\ 192 × 3 = 576\\\\ \end{align}$$
|
||||||
|
|
||||||
Ao concatenar cada produto, chegamos ao total 192384576. Esse resultado possui 9 dígitos e usa todos os número de 1 a 9 pelo menos uma vez. Chamaremos 192384576 o produto concatenado de 192 e (1, 2, 3).
|
Ao concatenar cada produto, chegamos ao total 192384576. Esse resultado possui 9 algarismos e usa todos os números de 1 a 9 pelo menos uma vez. Chamaremos 192384576 o produto concatenado de 192 e (1, 2, 3).
|
||||||
|
|
||||||
O mesmo pode ser alcançado começando por 9 e multiplicando por 1, 2, 3, 4 e 5. O resultado é o pandigital 918273645, que é o produto concatenado de 9 e (1, 2, 3, 4, 5).
|
O mesmo pode ser alcançado começando por 9 e multiplicando por 1, 2, 3, 4 e 5. O resultado é o pandigital 918273645, que é o produto concatenado de 9 e (1, 2, 3, 4, 5).
|
||||||
|
|
||||||
Qual é o maior número pandigital de 1 a `k` com `k` dígitos que pode ser formado como o produto concatenado de um inteiro com (1, 2, ..., `n`) onde `n` > 1?
|
Qual é o maior número pandigital de 1 a `k` com `k` algarismos que pode ser formado como o produto concatenado de um inteiro com (1, 2, ..., `n`) onde `n` > 1?
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ dashedName: problem-4-largest-palindrome-product
|
|||||||
|
|
||||||
Um número palíndromo é aquele que pode ser lido da esquerda para a direita e vice-versa. O maior palíndromo feito a partir do produto de dois algarismos é 9009 = 91 × 99.
|
Um número palíndromo é aquele que pode ser lido da esquerda para a direita e vice-versa. O maior palíndromo feito a partir do produto de dois algarismos é 9009 = 91 × 99.
|
||||||
|
|
||||||
Encontre o maior palíndromo feito a partir do produto de dois números de `n` dígitos.
|
Encontre o maior palíndromo feito a partir do produto de dois números de `n` algarismos.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ Uma fração decimal irracional é criada concatenando os números inteiros posi
|
|||||||
|
|
||||||
Podemos notar que o 12º algarismo da parte fracionária é 1.
|
Podemos notar que o 12º algarismo da parte fracionária é 1.
|
||||||
|
|
||||||
Se *d<sub>n</sub>* representa o *n*-ésimo dígito da parte fracionária, encontre o valor da expressão a seguir:
|
Se *d<sub>n</sub>* representa o *n*-ésimo algarismo da parte fracionária, encontre o valor da expressão a seguir:
|
||||||
|
|
||||||
d<sub>1</sub> × d<sub>10</sub> × d<sub>100</sub> × d<sub>1000</sub> × d<sub>10000</sub> × d<sub>100000</sub> × d<sub>1000000</sub>
|
d<sub>1</sub> × d<sub>10</sub> × d<sub>100</sub> × d<sub>1000</sub> × d<sub>10000</sub> × d<sub>100000</sub> × d<sub>1000000</sub>
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ Considere $f(k)$ como o número de movimentos vencedores do primeiro jogador (ou
|
|||||||
|
|
||||||
Por exemplo, $f(5) = 1$ e $f(10) = 17$.
|
Por exemplo, $f(5) = 1$ e $f(10) = 17$.
|
||||||
|
|
||||||
Encontre $f(10000)$. Dê os últimos 18 dígitos da sua resposta.
|
Encontre $f(10000)$. Dê os últimos 18 algarismos da sua resposta.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ dashedName: problem-41-pandigital-prime
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Dizemos que um número de `n` dígitos é pandigital se ele usar todos os dígitos de 1 a `n` exatamente uma vez. Por exemplo, 2143 é um número pandigital de 4 algarismos e também é um número primo.
|
Dizemos que um número de `n` algarismos é pandigital se ele usar todos os algarismos de 1 a `n` exatamente uma vez. Por exemplo, 2143 é um número pandigital de 4 algarismos e também é um número primo.
|
||||||
|
|
||||||
Qual é o maior número primo pandigital de comprimento `n` que existe?
|
Qual é o maior número primo pandigital de comprimento `n` que existe?
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f5081000cf542c510019
|
id: 5900f5081000cf542c510019
|
||||||
title: 'Problem 411: Uphill paths'
|
title: 'Problema 411: Caminhos ladeira acima'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302080
|
forumTopicId: 302080
|
||||||
dashedName: problem-411-uphill-paths
|
dashedName: problem-411-uphill-paths
|
||||||
@ -8,22 +8,26 @@ dashedName: problem-411-uphill-paths
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Let n be a positive integer. Suppose there are stations at the coordinates (x, y) = (2i mod n, 3i mod n) for 0 ≤ i ≤ 2n. We will consider stations with the same coordinates as the same station.
|
Considere $n$ um inteiro positivo. Suponha que haja estações nas coordenadas $(x, y) = (2^i\bmod n, 3^i\bmod n)$ para $0 ≤ i ≤ 2n$. Consideraremos estações com as mesmas coordenadas que a mesma estação.
|
||||||
|
|
||||||
We wish to form a path from (0, 0) to (n, n) such that the x and y coordinates never decrease. Let S(n) be the maximum number of stations such a path can pass through.
|
Queremos formar um caminho de (0, 0) a ($n$, $n$) de modo que as coordenadas $x$ e $y$ nunca diminuam.
|
||||||
|
|
||||||
For example, if n = 22, there are 11 distinct stations, and a valid path can pass through at most 5 stations. Therefore, S(22) = 5. The case is illustrated below, with an example of an optimal path:
|
Considere $S(n)$ como o número máximo de estações pelas quais um caminho pode passar.
|
||||||
|
|
||||||
It can also be verified that S(123) = 14 and S(10000) = 48.
|
Por exemplo, se $n = 22$, existem 11 estações distintas, e um caminho válido pode passar por, no máximo, 5 estações. Portanto, $S(22) = 5$. O caso é ilustrado abaixo, com um exemplo de caminho ideal:
|
||||||
|
|
||||||
Find ∑ S(k5) for 1 ≤ k ≤ 30.
|
<img class="img-responsive center-block" alt="caminho válido passando por 5 estações, para n = 22, com 11 estações distintas" src="https://cdn.freecodecamp.org/curriculum/project-euler/uphill-paths.png" style="background-color: white; padding: 10px;" />
|
||||||
|
|
||||||
|
Também pode ser verificado que $S(123) = 14$ e $S(10.000) = 48$.
|
||||||
|
|
||||||
|
Encontre a $\sum S(k^5)$ para $1 ≤ k ≤ 30$.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler411()` should return 9936352.
|
`uphillPaths()` deve retornar `9936352`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler411(), 9936352);
|
assert.strictEqual(uphillPaths(), 9936352);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -31,12 +35,12 @@ assert.strictEqual(euler411(), 9936352);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler411() {
|
function uphillPaths() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler411();
|
uphillPaths();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f5081000cf542c51001a
|
id: 5900f5081000cf542c51001a
|
||||||
title: 'Problem 412: Gnomon numbering'
|
title: 'Problema 412: Númeração de Gnomon'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302081
|
forumTopicId: 302081
|
||||||
dashedName: problem-412-gnomon-numbering
|
dashedName: problem-412-gnomon-numbering
|
||||||
@ -8,24 +8,28 @@ dashedName: problem-412-gnomon-numbering
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
For integers m, n (0 ≤ n < m), let L(m, n) be an m×m grid with the top-right n×n grid removed.
|
Para números inteiros $m$, $n$ ($0 ≤ n < m$), considere $L(m, n)$ como uma grade $m×m$ grid com a parte superior direita $n×n$ da grade removida.
|
||||||
|
|
||||||
For example, L(5, 3) looks like this:
|
Por exemplo, $L(5, 3)$ terá essa aparência:
|
||||||
|
|
||||||
We want to number each cell of L(m, n) with consecutive integers 1, 2, 3, ... such that the number in every cell is smaller than the number below it and to the left of it.
|
<img class="img-responsive center-block" alt="grade 5x5, com a grade 3x3 do canto superior direito removida" src="https://cdn.freecodecamp.org/curriculum/project-euler/gnomon-numbering-1.png" style="background-color: white; padding: 10px;" />
|
||||||
|
|
||||||
For example, here are two valid numberings of L(5, 3):
|
Queremos numerar cada célula de $L(m, n)$ com números inteiros consecutivos 1, 2, 3, ... tal que o número em cada célula seja menor que o número abaixo e à esquerda dele.
|
||||||
|
|
||||||
Let LC(m, n) be the number of valid numberings of L(m, n). It can be verified that LC(3, 0) = 42, LC(5, 3) = 250250, LC(6, 3) = 406029023400 and LC(10, 5) mod 76543217 = 61251715.
|
Por exemplo, aqui temos duas numerações válidas de $L(5, 3)$:
|
||||||
|
|
||||||
Find LC(10000, 5000) mod 76543217.
|
<img class="img-responsive center-block" alt="duas numerações válidas de L(5, 3)" src="https://cdn.freecodecamp.org/curriculum/project-euler/gnomon-numbering-2.png" style="background-color: white; padding: 10px;" />
|
||||||
|
|
||||||
|
Considere $LC(m, n)$ como a quantidade de numerações válidas de $L(m, n)$. Pode-se verificar que $LC(3, 0) = 42$, $LC(5, 3) = 250.250$, $LC(6, 3) = 406.029.023.400$ e $LC(10, 5)\bmod 76.543.217 = 61.251.715$.
|
||||||
|
|
||||||
|
Encontre $LC(10.000, 5.000)\bmod 76.543.217$.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler412()` should return 38788800.
|
`gnomonNumbering()` deve retornar `38788800`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler412(), 38788800);
|
assert.strictEqual(gnomonNumbering(), 38788800);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -33,12 +37,12 @@ assert.strictEqual(euler412(), 38788800);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler412() {
|
function gnomonNumbering() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler412();
|
gnomonNumbering();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f50a1000cf542c51001c
|
id: 5900f50a1000cf542c51001c
|
||||||
title: 'Problem 413: One-child Numbers'
|
title: 'Problema 413: Números com um filho'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302082
|
forumTopicId: 302082
|
||||||
dashedName: problem-413-one-child-numbers
|
dashedName: problem-413-one-child-numbers
|
||||||
@ -8,20 +8,22 @@ dashedName: problem-413-one-child-numbers
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
We say that a d-digit positive number (no leading zeros) is a one-child number if exactly one of its sub-strings is divisible by d.
|
Dizemos que um número positivo de $d$ algarismos (sem zeros à esquerda) é um número com um filho se exatamente uma de suas substrings for divisível por $d$.
|
||||||
|
|
||||||
For example, 5671 is a 4-digit one-child number. Among all its sub-strings 5, 6, 7, 1, 56, 67, 71, 567, 671 and 5671, only 56 is divisible by 4. Similarly, 104 is a 3-digit one-child number because only 0 is divisible by 3. 1132451 is a 7-digit one-child number because only 245 is divisible by 7.
|
Por exemplo, 5671 é um número com um filho de 4 algarismos. Entre todas as suas substrings 5, 6, 7, 1, 56, 67, 71, 567, 671 e 5671, apenas 56 é divisível por 4.
|
||||||
|
|
||||||
Let F(N) be the number of the one-child numbers less than N. We can verify that F(10) = 9, F(103) = 389 and F(107) = 277674.
|
Da mesma forma, 104 é um número com um filho de 3 algarismos, pois apenas 0 é divisível por 3. 1132451 é um número com um filho de 7 algarismos, pois apenas 245 é divisível por 7.
|
||||||
|
|
||||||
Find F(1019).
|
Considere $F(N)$ como a quantidade de números com um filho inferiores a $N$. Podemos verificar que $F(10) = 9$, $F({10}^3) = 389$ e $F({10}^7) = 277.674$.
|
||||||
|
|
||||||
|
Encontre $F({10}^{19})$.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler413()` should return 3079418648040719.
|
`oneChildNumbers()` deve retornar `3079418648040719`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler413(), 3079418648040719);
|
assert.strictEqual(oneChildNumbers(), 3079418648040719);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -29,12 +31,12 @@ assert.strictEqual(euler413(), 3079418648040719);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler413() {
|
function oneChildNumbers() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler413();
|
oneChildNumbers();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f50b1000cf542c51001d
|
id: 5900f50b1000cf542c51001d
|
||||||
title: 'Problem 414: Kaprekar constant'
|
title: 'Problema 414: Constante de Kaprekar'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302083
|
forumTopicId: 302083
|
||||||
dashedName: problem-414-kaprekar-constant
|
dashedName: problem-414-kaprekar-constant
|
||||||
@ -8,36 +8,39 @@ dashedName: problem-414-kaprekar-constant
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
6174 is a remarkable number; if we sort its digits in increasing order and subtract that number from the number you get when you sort the digits in decreasing order, we get 7641-1467=6174.
|
6174 é um número incrível. Se ordenarmos seus algarismos em ordem crescente e subtrairmos esse número do número obtido ao ordenar os algarismos em ordem decrescente, temos $7641 - 1467 = 6174$.
|
||||||
|
|
||||||
Even more remarkable is that if we start from any 4 digit number and repeat this process of sorting and subtracting, we'll eventually end up with 6174 or immediately with 0 if all digits are equal.
|
Ainda mais incrível é o fato de que, se começarmos com qualquer número de 4 algarismos e repetirmos esse processo de ordenação e subtração, em algum momento chegaremos a 6174 ou imediatamente a 0 se todos os algarismos forem iguais.
|
||||||
|
|
||||||
This also works with numbers that have less than 4 digits if we pad the number with leading zeroes until we have 4 digits.
|
Isso também funciona com números que têm menos de 4 algarismos se colocarmos zeros à esquerda do número até chegarmos a 4 algarismos.
|
||||||
|
|
||||||
E.g. let's start with the number 0837:
|
Ex: vamos começar com o número 0837:
|
||||||
|
|
||||||
8730-0378=8352
|
$$\begin{align} & 8730 - 0378 = 8352 \\\\ & 8532 - 2358 = 6174 \end{align}$$
|
||||||
|
|
||||||
8532-2358=6174
|
6174 é chamado de constante de Kaprekar. O processo de ordenar e subtrair e repetir isso até chegar a 0 ou à constante de Kaprekar é chamado de rotina de Kaprekar.
|
||||||
|
|
||||||
6174 is called the Kaprekar constant. The process of sorting and subtracting and repeating this until either 0 or the Kaprekar constant is reached is called the Kaprekar routine.
|
Podemos considerar a rotina de Kaprekar para outras bases e quantidades de algarismos. Infelizmente, não é garantido que uma constante de Kaprekar exista em todos os casos; ou a rotina pode terminar em um ciclo para alguns números de entrada ou a constante a qual a rotina chega pode diferir para números de entrada diversos. Podemos, no entanto, mostrar que, para 5 algarismos e uma base $b = 6t + 3 ≠ 9$, existe uma constante de Kaprekar.
|
||||||
|
|
||||||
We can consider the Kaprekar routine for other bases and number of digits. Unfortunately, it is not guaranteed a Kaprekar constant exists in all cases; either the routine can end up in a cycle for some input numbers or the constant the routine arrives at can be different for different input numbers. However, it can be shown that for 5 digits and a base b = 6t+3≠9, a Kaprekar constant exists. E.g. base 15: (10,4,14,9,5)15 base 21: (14,6,20,13,7)21
|
Ex: base 15: ${(10, 4, 14, 9, 5)}\_{15}$ base 21: $(14, 6, 20, 13, 7)_{21}$
|
||||||
|
|
||||||
Define Cb to be the Kaprekar constant in base b for 5 digits. Define the function sb(i) to be 0 if i = Cb or if i written in base b consists of 5 identical digits the number of iterations it takes the Kaprekar routine in base b to arrive at Cb, otherwise
|
Defina $C_b$ como a constante de Kaprekar na base $b$ para 5 algarismos. Defina a função $sb(i)$ como:
|
||||||
|
|
||||||
Note that we can define sb(i) for all integers i < b5. If i written in base b takes less than 5 digits, the number is padded with leading zero digits until we have 5 digits before applying the Kaprekar routine.
|
- 0 se $i = C_b$ ou se $i$ escrito na base $b$ consiste em 5 algarismos idênticos
|
||||||
|
- o número de iterações necessário para que a rotina de Kaprekar na base $b$ chegue a $C_b$, em outros casos
|
||||||
|
|
||||||
Define S(b) as the sum of sb(i) for 0 < i < b5. E.g. S(15) = 5274369 S(111) = 400668930299
|
Observe que podemos definir $sb(i)$ para todos os números inteiros $i < b^5$. Se $i$ escrito na base $b$ tiver menos de 5 algarismos, o número recebe algarismos zero à esquerda até chegar a 5 algarismos antes de aplicar a rotina de Kaprekar.
|
||||||
|
|
||||||
Find the sum of S(6k+3) for 2 ≤ k ≤ 300. Give the last 18 digits as your answer.
|
Defina $S(b)$ como a soma de $sb(i)$ para $0 < i < b^5$. Ex: $S(15) = 5.274.369$ $S(111) = 400.668.930.299$
|
||||||
|
|
||||||
|
Encontre a soma de $S(6k + 3)$ para $2 ≤ k ≤ 300$. Dê os últimos 18 algarismos da sua resposta.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler414()` should return 552506775824935500.
|
`kaprekarConstant()` deve retornar `552506775824935500`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler414(), 552506775824935500);
|
assert.strictEqual(kaprekarConstant(), 552506775824935500);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -45,12 +48,12 @@ assert.strictEqual(euler414(), 552506775824935500);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler414() {
|
function kaprekarConstant() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler414();
|
kaprekarConstant();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -14,7 +14,7 @@ Considere que $F(m, n)$ é o número de maneiras pelas quais o sapo pode viajar,
|
|||||||
|
|
||||||
Por exemplo, $F(1, 3) = 4$, $F(1, 4) = 15$, $F(1, 5) = 46$, $F(2, 3) = 16$ e $F(2, 100)\bmod {10}^9 = 429.619.151$.
|
Por exemplo, $F(1, 3) = 4$, $F(1, 4) = 15$, $F(1, 5) = 46$, $F(2, 3) = 16$ e $F(2, 100)\bmod {10}^9 = 429.619.151$.
|
||||||
|
|
||||||
Encontre os últimos 9 dígitos de $F(10, {10}^{12})$.
|
Encontre os últimos 9 algarismos de $F(10, {10}^{12})$.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ Em uma fração unitária, o numerador é 1. A representação decimal das fraç
|
|||||||
|
|
||||||
$$\begin{align} & \frac{1}{2} = 0.5 \\\\ & \frac{1}{3} = 0.(3) \\\\ & \frac{1}{4} = 0.25 \\\\ & \frac{1}{5} = 0.2 \\\\ & \frac{1}{6} = 0.1(6) \\\\ & \frac{1}{7} = 0.(142857) \\\\ & \frac{1}{8} = 0.125 \\\\ & \frac{1}{9} = 0.(1) \\\\ & \frac{1}{10} = 0.1 \\\\ \end{align}$$
|
$$\begin{align} & \frac{1}{2} = 0.5 \\\\ & \frac{1}{3} = 0.(3) \\\\ & \frac{1}{4} = 0.25 \\\\ & \frac{1}{5} = 0.2 \\\\ & \frac{1}{6} = 0.1(6) \\\\ & \frac{1}{7} = 0.(142857) \\\\ & \frac{1}{8} = 0.125 \\\\ & \frac{1}{9} = 0.(1) \\\\ & \frac{1}{10} = 0.1 \\\\ \end{align}$$
|
||||||
|
|
||||||
A expressão $0.1(6)$ significa $0.16666666\dots$, e tem um ciclo recorrente de 1 algarismo. Pode ser visto que $\frac{1}{7}$ tem um ciclo recorrente de 6 dígitos.
|
A expressão $0.1(6)$ significa $0.16666666\dots$, e tem um ciclo recorrente de 1 algarismo. Pode ser visto que $\frac{1}{7}$ tem um ciclo recorrente de 6 algarismos.
|
||||||
|
|
||||||
Frações unitárias cujo denominador não tem outros fatores primos além de 2 e/ou 5 não são consideradas como tendo um ciclo recorrente. Definimos 0 como o comprimento do ciclo recorrente dessas frações unitárias.
|
Frações unitárias cujo denominador não tem outros fatores primos além de 2 e/ou 5 não são consideradas como tendo um ciclo recorrente. Definimos 0 como o comprimento do ciclo recorrente dessas frações unitárias.
|
||||||
|
|
||||||
|
@ -10,9 +10,9 @@ dashedName: problem-419-look-and-say-sequence
|
|||||||
|
|
||||||
A sequência para olhar e dizer é 1, 11, 21, 1211, 111221, 312211, 13112221, 1113213211, ...
|
A sequência para olhar e dizer é 1, 11, 21, 1211, 111221, 312211, 13112221, 1113213211, ...
|
||||||
|
|
||||||
A sequência começa com 1 e todos os outros membros são obtidos descrevendo o membro anterior em termos de dígitos consecutivos.
|
A sequência começa com 1 e todos os outros membros são obtidos descrevendo o membro anterior em termos de algarismos consecutivos.
|
||||||
|
|
||||||
Ajuda ler os dígitos em voz alta:
|
Ajuda ler os algarismos em voz alta:
|
||||||
|
|
||||||
1 é 'um um' $→ 11$
|
1 é 'um um' $→ 11$
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f5111000cf542c510023
|
id: 5900f5111000cf542c510023
|
||||||
title: 'Problem 420: 2x2 positive integer matrix'
|
title: 'Problema 420: Matriz de números inteiros positivos 2x2'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302090
|
forumTopicId: 302090
|
||||||
dashedName: problem-420-2x2-positive-integer-matrix
|
dashedName: problem-420-2x2-positive-integer-matrix
|
||||||
@ -8,20 +8,28 @@ dashedName: problem-420-2x2-positive-integer-matrix
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
A positive integer matrix is a matrix whose elements are all positive integers.
|
Uma matriz de números inteiros positivos é uma matriz cujos elementos são todos números inteiros positivos.
|
||||||
|
|
||||||
Some positive integer matrices can be expressed as a square of a positive integer matrix in two different ways. Here is an example:
|
Algumas matrizes de números inteiros positivos podem ser expressas como um quadrado de uma matriz de números inteiros positivos de duas formas diferentes. Exemplo:
|
||||||
|
|
||||||
We define F(N) as the number of the 2x2 positive integer matrices which have a trace less than N and which can be expressed as a square of a positive integer matrix in two different ways. We can verify that F(50) = 7 and F(1000) = 1019.
|
$$\begin{pmatrix} 40 & 12 \\\\ 48 & 40 \end{pmatrix} =
|
||||||
|
{\begin{pmatrix}
|
||||||
|
2 & 3 \\\\ 12 & 2 \end{pmatrix}}^2 =
|
||||||
|
{\begin{pmatrix}
|
||||||
|
6 & 1 \\\\ 4 & 6 \end{pmatrix}}^2$$
|
||||||
|
|
||||||
Find F(107).
|
Definimos $F(N)$ como a quantidade de matrizes de números inteiros positivos 2x2 que têm um traço inferior a N e que podem ser expressas como um quadrado de uma matriz de números inteiros positivos de duas formas diferentes.
|
||||||
|
|
||||||
|
Podemos verificar que $F(50) = 7$ e $F(1000) = 1019$.
|
||||||
|
|
||||||
|
Encontre $F({10}^7)$.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler420()` should return 145159332.
|
`positiveIntegerMatrix()` deve retornar `145159332`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler420(), 145159332);
|
assert.strictEqual(positiveIntegerMatrix(), 145159332);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -29,12 +37,12 @@ assert.strictEqual(euler420(), 145159332);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler420() {
|
function positiveIntegerMatrix() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler420();
|
positiveIntegerMatrix();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f5131000cf542c510024
|
id: 5900f5131000cf542c510024
|
||||||
title: 'Problem 421: Prime factors of n15+1'
|
title: 'Problema 421: Fatores primos de n15+1'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302091
|
forumTopicId: 302091
|
||||||
dashedName: problem-421-prime-factors-of-n151
|
dashedName: problem-421-prime-factors-of-n151
|
||||||
@ -8,20 +8,26 @@ dashedName: problem-421-prime-factors-of-n151
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Numbers of the form n15+1 are composite for every integer n > 1.
|
Números no formato $n^{15} + 1$ são compostos para cada número inteiro $n > 1$.
|
||||||
|
|
||||||
For positive integers n and m let s(n,m) be defined as the sum of the distinct prime factors of n15+1 not exceeding m.
|
Para números inteiros positivos $n$ e $m$, considere $s(n, m)$ como a soma dos fatores primos distintos de $n^{15} + 1$ não superior a $m$.
|
||||||
|
|
||||||
E.g. 215+1 = 3×3×11×331. So s(2,10) = 3 and s(2,1000) = 3+11+331 = 345.
|
Ex: $2^{15} + 1 = 3 × 3 × 11 × 331$.
|
||||||
|
|
||||||
Also 1015+1 = 7×11×13×211×241×2161×9091. So s(10,100) = 31 and s(10,1000) = 483. Find ∑ s(n,108) for 1 ≤ n ≤ 1011.
|
So $s(2, 10) = 3$ e $s(2, 1000) = 3 + 11 + 331 = 345$.
|
||||||
|
|
||||||
|
E também ${10}^{15} + 1 = 7 × 11 × 13 × 211 × 241 × 2161 × 9091$.
|
||||||
|
|
||||||
|
Assim, $s(10, 100) = 31$ e $s(10, 1000) = 483$.
|
||||||
|
|
||||||
|
Encontre a $\sum s(n, {10}^8)$ para $1 ≤ n ≤ {10}^{11}$.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler421()` should return 2304215802083466200.
|
`primeFactorsOfN15Plus1()` deve retornar `2304215802083466200`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler421(), 2304215802083466200);
|
assert.strictEqual(primeFactorsOfN15Plus1(), 2304215802083466200);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -29,12 +35,12 @@ assert.strictEqual(euler421(), 2304215802083466200);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler421() {
|
function primeFactorsOfN15Plus1() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler421();
|
primeFactorsOfN15Plus1();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f5131000cf542c510025
|
id: 5900f5131000cf542c510025
|
||||||
title: 'Problem 422: Sequence of points on a hyperbola'
|
title: 'Problema 422: Sequência de pontos em uma hipérbole'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302092
|
forumTopicId: 302092
|
||||||
dashedName: problem-422-sequence-of-points-on-a-hyperbola
|
dashedName: problem-422-sequence-of-points-on-a-hyperbola
|
||||||
@ -8,22 +8,30 @@ dashedName: problem-422-sequence-of-points-on-a-hyperbola
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Let H be the hyperbola defined by the equation 12x2 + 7xy - 12y2 = 625.
|
Considere $H$ como a hipérbole definida pela equação $12x^2 + 7xy - 12y^2 = 625$.
|
||||||
|
|
||||||
Next, define X as the point (7, 1). It can be seen that X is in H.
|
Em seguida, defina $X$ como o ponto (7, 1). Pode-se ver que $X$ está em $H$.
|
||||||
|
|
||||||
Now we define a sequence of points in H, {Pi : i ≥ 1}, as: P1 = (13, 61/4). P2 = (-43/6, -4). For i > 2, Pi is the unique point in H that is different from Pi-1 and such that line PiPi-1 is parallel to line Pi-2X. It can be shown that Pi is well-defined, and that its coordinates are always rational. You are given that P3 = (-19/2, -229/24), P4 = (1267/144, -37/12) and P7 = (17194218091/143327232, 274748766781/1719926784).
|
Definiremos uma sequência de pontos em $H, \\{P_i : i ≥ 1\\}$, como:
|
||||||
|
|
||||||
Find Pn for n = 1114 in the following format:If Pn = (a/b, c/d) where the fractions are in lowest terms and the denominators are positive, then the answer is (a + b + c + d) mod 1 000 000 007.
|
- $P_1 = (13, \frac{61}{4})$.
|
||||||
|
- $P_2 = (\frac{-43}{6}, -4)$.
|
||||||
|
- Para $i > 2$, $P_i$ é o único ponto $H$ que é diferente de $P_{i - 1}$ e tal que a linha $P_iP_{i - 1}$ é paralela à linha $P_{i - 2}X$. Pode-se ver que $P_i$ está corretamente definido e que suas coordenadas são sempre racionais.
|
||||||
|
|
||||||
For n = 7, the answer would have been: 806236837.
|
<img class="img-responsive center-block" alt="animação mostrando os pontos de definição de P_1 a P_6" src="https://cdn.freecodecamp.org/curriculum/project-euler/sequence-of-points-on-a-hyperbola.gif" style="background-color: white; padding: 10px;" />
|
||||||
|
|
||||||
|
Você é informado de que $P_3 = (\frac{-19}{2}, \frac{-229}{24})$, $P_4 = (\frac{1267}{144}, \frac{-37}{12})$ and $P_7 = (\frac{17.194.218.091}{143.327.232}, \frac{274.748.766.781}{1.719.926.784})$.
|
||||||
|
|
||||||
|
Encontre $P_n$ para $n = {11}^{14}$ no seguinte formato: se $P_n = (\frac{a}{b}, \frac{c}{d})$, onde as frações estão nos menores termos e os denominadores são positivos, então a resposta é $(a + b + c + d)\bmod 1.000.000.007$.
|
||||||
|
|
||||||
|
Para $n = 7$, a resposta seria: $806.236.837$.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler422()` should return 92060460.
|
`sequenceOfPointsOnHyperbola()` deve retornar `92060460`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler422(), 92060460);
|
assert.strictEqual(sequenceOfPointsOnHyperbola(), 92060460);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -31,12 +39,12 @@ assert.strictEqual(euler422(), 92060460);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler422() {
|
function sequenceOfPointsOnHyperbola() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler422();
|
sequenceOfPointsOnHyperbola();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f5141000cf542c510027
|
id: 5900f5141000cf542c510027
|
||||||
title: 'Problem 423: Consecutive die throws'
|
title: 'Problema 423: Lançamentos consecutivos de dados'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302093
|
forumTopicId: 302093
|
||||||
dashedName: problem-423-consecutive-die-throws
|
dashedName: problem-423-consecutive-die-throws
|
||||||
@ -8,26 +8,34 @@ dashedName: problem-423-consecutive-die-throws
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Let n be a positive integer.
|
Considere $n$ um inteiro positivo.
|
||||||
|
|
||||||
A 6-sided die is thrown n times. Let c be the number of pairs of consecutive throws that give the same value.
|
Um dado de 6 lados é lançado $n$ vezes. Considere $c$ como o número de pares de lançamentos consecutivos que dão o mesmo valor.
|
||||||
|
|
||||||
For example, if n = 7 and the values of the die throws are (1,1,5,6,6,6,3), then the following pairs of consecutive throws give the same value: (1,1,5,6,6,6,3) (1,1,5,6,6,6,3) (1,1,5,6,6,6,3) Therefore, c = 3 for (1,1,5,6,6,6,3).
|
Por exemplo, se $n = 7$ e os valores dos lançamentos dos dados são (1, 1, 5, 6, 6, 6, 3), os seguintes pares de lançamentos consecutivos dão o mesmo valor:
|
||||||
|
|
||||||
Define C(n) as the number of outcomes of throwing a 6-sided die n times such that c does not exceed π(n).1 For example, C(3) = 216, C(4) = 1290, C(11) = 361912500 and C(24) = 4727547363281250000.
|
$$\begin{align} & (\underline{1}, \underline{1}, 5, 6, 6, 6, 3) \\\\ & (1, 1, 5, \underline{6}, \underline{6}, 6, 3) \\\\ & (1, 1, 5, 6, \underline{6}, \underline{6}, 3) \end{align}$$
|
||||||
|
|
||||||
Define S(L) as ∑ C(n) for 1 ≤ n ≤ L. For example, S(50) mod 1 000 000 007 = 832833871.
|
Portanto, $c = 3$ para (1, 1, 5, 6, 6, 6, 3).
|
||||||
|
|
||||||
Find S(50 000 000) mod 1 000 000 007.
|
Defina $C(n)$ como o número de resultados de lançar um dado de 6 lados $n$ vezes, tal que $c$ não exceda $π(n)$.<sup>1</sup>
|
||||||
|
|
||||||
1 π denotes the prime-counting function, i.e. π(n) is the number of primes ≤ n.
|
Por exemplo, $C(3) = 216$, $C(4) = 1290$, $C(11) = 361.912.500$ e $C(24) = 4.727.547.363.281.250.000$.
|
||||||
|
|
||||||
|
Defina $S(L)$ como $\sum C(n)$ para $1 ≤ n ≤ L$.
|
||||||
|
|
||||||
|
Por exemplo, $S(50)\bmod 1.000.000.007 = 832.833.871$.
|
||||||
|
|
||||||
|
Encontre $S(50.000.000)\bmod 1.000.000.007$.
|
||||||
|
|
||||||
|
<sup>1</sup> $π$ é a função de contagem de números primos, ou seja, $π(n)$ é a quantidade de números primos $≤ n$.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler423()` should return 653972374.
|
`consecutiveDieThrows()` deve retornar `653972374`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler423(), 653972374);
|
assert.strictEqual(consecutiveDieThrows(), 653972374);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -35,12 +43,12 @@ assert.strictEqual(euler423(), 653972374);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler423() {
|
function consecutiveDieThrows() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler423();
|
consecutiveDieThrows();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f5151000cf542c510028
|
id: 5900f5151000cf542c510028
|
||||||
title: 'Problem 425: Prime connection'
|
title: 'Problema 425: Conexão de números primos'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302095
|
forumTopicId: 302095
|
||||||
dashedName: problem-425-prime-connection
|
dashedName: problem-425-prime-connection
|
||||||
@ -8,26 +8,29 @@ dashedName: problem-425-prime-connection
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Two positive numbers A and B are said to be connected (denoted by "A ↔ B") if one of these conditions holds:
|
Dois números positivos $A$ e $B$ devem ser conectados (denotado por "$A ↔ B$") se uma destas condições se mantiver:
|
||||||
|
|
||||||
(1) A and B have the same length and differ in exactly one digit; for example, 123 ↔ 173.
|
1. $A$ e $B$ têm o mesmo comprimento e diferem em exatamente um algarismo; por exemplo, $123 ↔ 173$.
|
||||||
|
2. Adicionar um algarismo à esquerda de $A$ (ou $B$) gera $B$ (ou $A$); por exemplo, $23 ↔ 223$ e $123 ↔ 23$.
|
||||||
|
|
||||||
(2) Adding one digit to the left of A (or B) makes B (or A); for example, 23 ↔ 223 and 123 ↔ 23.
|
Chamamos um número primo $P$ um parente de 2 se existir uma cadeia de primos conectados entre 2 e $P$ e se nenhum primo na cadeia exceder $P$.
|
||||||
|
|
||||||
We call a prime P a 2's relative if there exists a chain of connected primes between 2 and P and no prime in the chain exceeds P.
|
Por exemplo, 127 é um parente de 2. Uma das cadeias possíveis é mostrada abaixo:
|
||||||
|
|
||||||
For example, 127 is a 2's relative. One of the possible chains is shown below: 2 ↔ 3 ↔ 13 ↔ 113 ↔ 103 ↔ 107 ↔ 127 However, 11 and 103 are not 2's relatives.
|
$$2 ↔ 3 ↔ 13 ↔ 113 ↔ 103 ↔ 107 ↔ 127$$
|
||||||
|
|
||||||
Let F(N) be the sum of the primes ≤ N which are not 2's relatives. We can verify that F(103) = 431 and F(104) = 78728.
|
No entanto, 11 e 103 não são parentes de 2.
|
||||||
|
|
||||||
Find F(107).
|
Considere $F(N)$ como a soma dos primos $≤ N$ que não são parentes de 2. Pode-se verificar que $F({10}^3) = 431$ e que $F({10}^4) = 78.728.$.
|
||||||
|
|
||||||
|
Encontre $F({10}^7)$.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler425()` should return 46479497324.
|
`primeConnection()` deve retornar `46479497324`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler425(), 46479497324);
|
assert.strictEqual(primeConnection(), 46479497324);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -35,12 +38,12 @@ assert.strictEqual(euler425(), 46479497324);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler425() {
|
function primeConnection() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler425();
|
primeConnection();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f5171000cf542c510029
|
id: 5900f5171000cf542c510029
|
||||||
title: 'Problem 426: Box-ball system'
|
title: 'Problema 426: Sistema de esfera e caixa'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302096
|
forumTopicId: 302096
|
||||||
dashedName: problem-426-box-ball-system
|
dashedName: problem-426-box-ball-system
|
||||||
@ -8,26 +8,36 @@ dashedName: problem-426-box-ball-system
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Consider an infinite row of boxes. Some of the boxes contain a ball. For example, an initial configuration of 2 consecutive occupied boxes followed by 2 empty boxes, 2 occupied boxes, 1 empty box, and 2 occupied boxes can be denoted by the sequence (2, 2, 2, 1, 2), in which the number of consecutive occupied and empty boxes appear alternately.
|
Considere uma linha infinita de caixas. Algumas das caixas têm uma esfera. Por exemplo, uma configuração inicial de 2 caixas ocupadas consecutivas seguidas por 2 caixas vazias, 2 caixas ocupadas, 1 caixa vazia, e 2 caixas ocupadas pode ser indicada pela sequência (2, 2, 2, 1, 2), onde o número de caixas ocupadas e vazias consecutivas aparece alternadamente.
|
||||||
|
|
||||||
A turn consists of moving each ball exactly once according to the following rule: Transfer the leftmost ball which has not been moved to the nearest empty box to its right.
|
Um turno consiste em mover cada esfera exatamente uma vez, de acordo com a seguinte regra: transfira a esfera mais à esquerda, que não foi movida para a caixa vazia mais próxima à sua direita.
|
||||||
|
|
||||||
After one turn the sequence (2, 2, 2, 1, 2) becomes (2, 2, 1, 2, 3) as can be seen below; note that we begin the new sequence starting at the first occupied box.
|
Depois de um movimento, a sequência (2, 2, 2, 1, 2) torna-se (2, 2, 1, 2, 3) como pode ser visto abaixo. Note-se que começamos a nova sequência a partir da primeira caixa ocupada.
|
||||||
|
|
||||||
A system like this is called a Box-Ball System or BBS for short.
|
<img class="img-responsive center-block" alt="animação mostrando um movimento completo de (2, 2, 2, 1, 2) para (2, 2, 1, 2, 3)" src="https://cdn.freecodecamp.org/curriculum/project-euler/box-ball-system-1.gif" style="background-color: white; padding: 10px;" />
|
||||||
|
|
||||||
It can be shown that after a sufficient number of turns, the system evolves to a state where the consecutive numbers of occupied boxes is invariant. In the example below, the consecutive numbers of occupied boxes evolves to \[1, 2, 3]; we shall call this the final state.
|
Um sistema como esse se chama um sistema de esfera e caixa ou BBS (Box-Ball System) para abreviação.
|
||||||
|
|
||||||
We define the sequence {ti}:s0 = 290797 sk+1 = sk2 mod 50515093 tk = (sk mod 64) + 1
|
Pode-se mostrar que após um número suficiente de movimentos, o sistema evolui para um estado onde o número consecutivo de caixas ocupadas é invariável. No exemplo abaixo, os números consecutivos de caixas ocupadas evoluem para [1, 2, 3]; chamaremos isso de estado final.
|
||||||
|
|
||||||
Starting from the initial configuration (t0, t1, …, t10), the final state becomes \[1, 3, 10, 24, 51, 75]. Starting from the initial configuration (t0, t1, …, t10 000 000), find the final state. Give as your answer the sum of the squares of the elements of the final state. For example, if the final state is \[1, 2, 3] then 14 ( = 12 + 22 + 32) is your answer.
|
<img class="img-responsive center-block" alt="quatro movimentos de caixas ocupadas [2, 2, 2] para o estado final [1, 2, 3]" src="https://cdn.freecodecamp.org/curriculum/project-euler/box-ball-system-2.gif" style="background-color: white; padding: 10px;" />
|
||||||
|
|
||||||
|
Definimos a sequência $\\{t_i\\}$:
|
||||||
|
|
||||||
|
$$\begin{align} & s_0 = 290.797 \\\\ & s_{k + 1} = {s_k}^2\bmod 50.515.093 \\\\ & t_k = (s_k\bmod 64) + 1 \end{align}$$
|
||||||
|
|
||||||
|
Começando da configuração inicial $(t_0, t_1, \ldots, t_{10})$, o estado final se torna [1, 3, 10, 24, 51, 75].
|
||||||
|
|
||||||
|
Começando da configuração inicial $(t_0, t_1, \ldots, t_{10.000.000})$, encontre o estado final.
|
||||||
|
|
||||||
|
Dê como sua resposta a soma dos quadrados dos elementos do estado final. Por exemplo, se o estado final é [1, 2, 3], então $14 (= 1^2 + 2^2 + 3^2)$ é a sua resposta.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler426()` should return 31591886008.
|
`boxBallSystem()` deve retornar `31591886008`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler426(), 31591886008);
|
assert.strictEqual(boxBallSystem(), 31591886008);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -35,12 +45,12 @@ assert.strictEqual(euler426(), 31591886008);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler426() {
|
function boxBallSystem() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler426();
|
boxBallSystem();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f5181000cf542c51002a
|
id: 5900f5181000cf542c51002a
|
||||||
title: 'Problem 427: n-sequences'
|
title: 'Problema 427: Sequencias n'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302097
|
forumTopicId: 302097
|
||||||
dashedName: problem-427-n-sequences
|
dashedName: problem-427-n-sequences
|
||||||
@ -8,24 +8,24 @@ dashedName: problem-427-n-sequences
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
A sequence of integers S = {si} is called an n-sequence if it has n elements and each element si satisfies 1 ≤ si ≤ n. Thus there are nn distinct n-sequences in total.
|
Uma sequência de números inteiros $S = \\{s_i\\}$ é chamada de sequência $n$ se ela tem $n$ elementos e cada elemento $s_i$ satisfaz $1 ≤ s_i ≤ n$. Portanto, há $n^n$ sequências $n$ distintas no total.
|
||||||
|
|
||||||
For example, the sequence S = {1, 5, 5, 10, 7, 7, 7, 2, 3, 7} is a 10-sequence.
|
Por exemplo, a sequência $S = \\{1, 5, 5, 10, 7, 7, 7, 2, 3, 7\\}$ é uma sequência de 10.
|
||||||
|
|
||||||
For any sequence S, let L(S) be the length of the longest contiguous subsequence of S with the same value. For example, for the given sequence S above, L(S) = 3, because of the three consecutive 7's.
|
Para qualquer sequência $S$, considere $L(S)$ como o comprimento da subsequência contígua mais longa de $S$ com o mesmo valor. Por exemplo, para a sequência $S$ dada acima, $L(S) = 3$, por causa dos três 7 consecutivos.
|
||||||
|
|
||||||
Let f(n) = ∑ L(S) for all n-sequences S.
|
Considere $f(n) = \sum L(S)$ para todas as $S$ sequências $n$.
|
||||||
|
|
||||||
For example, f(3) = 45, f(7) = 1403689 and f(11) = 481496895121.
|
Por exemplo, $f(3) = 45$, $f(7) = 1.403.689$ e $f(11) = 481.496.895.121$.
|
||||||
|
|
||||||
Find f(7 500 000) mod 1 000 000 009.
|
Encontre $f(7.500.000)\bmod 1.000.000.009$.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler427()` should return 97138867.
|
`nSequences()` deve retornar `97138867`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler427(), 97138867);
|
assert.strictEqual(nSequences(), 97138867);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -33,12 +33,12 @@ assert.strictEqual(euler427(), 97138867);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler427() {
|
function nSequences() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler427();
|
nSequences();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f5191000cf542c51002b
|
id: 5900f5191000cf542c51002b
|
||||||
title: 'Problem 428: Necklace of Circles'
|
title: 'Problema 428: Colar de círculos'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302098
|
forumTopicId: 302098
|
||||||
dashedName: problem-428-necklace-of-circles
|
dashedName: problem-428-necklace-of-circles
|
||||||
@ -8,27 +8,32 @@ dashedName: problem-428-necklace-of-circles
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Let `a`, `b` and `c` be positive numbers.
|
Considere $a$, $b$ e $c$ números positivos.
|
||||||
|
|
||||||
Let W, X, Y, Z be four collinear points where |WX| = `a`, |XY| = `b`, |YZ| = `c` and |WZ| = `a` + `b` + `c`.
|
Considere $W$, $X$, $Y$, $Z$ como quatro pontos colineares, onde $|WX| = a$, $|XY| = b$, $|YZ| = c$ e $|WZ| = a + b + c$.
|
||||||
|
|
||||||
Let C<sub>in</sub> be the circle having the diameter XY.
|
Considere $C_{\text{in}}$ como o círculo com o diâmetro $XY$.
|
||||||
|
|
||||||
Let C<sub>out</sub> be the circle having the diameter WZ.
|
Considere $C_{\text{out}}$ como o círculo com o diâmetro $WZ$.
|
||||||
|
|
||||||
The triplet (`a`, `b`, `c`) is called a *necklace triplet* if you can place `k` ≥ 3 distinct circles C<sub>1</sub>, C<sub>2</sub>, ..., C<sub><var>k</var></sub> such that:
|
O trio ($a$, $b$, $c$) é chamado de *trio do colar* se você puder dispor $k ≥ 3$ círculos distintos $C_1, C_2, \ldots, C_k$, tais que:
|
||||||
|
|
||||||
<ul><li>C<sub><var>i</var></sub> has no common interior points with any C<sub><var>j</var></sub> for 1 ≤ <var>i</var>, <var>j</var> ≤ <var>k</var> and <var>i</var> ≠ <var>j</var>,</li><li>C<sub><var>i</var></sub> is tangent to both C<sub>in</sub> and C<sub>out</sub> for 1 ≤ <var>i</var> ≤ <var>k</var>,</li><li>C<sub><var>i</var></sub> is tangent to C<sub><var>i</var>+1</sub> for 1 ≤ <var>i</var> < <var>k</var>, and</li><li>C<sub><var>k</var></sub> is tangent to C<sub>1</sub>.</li></ul>
|
- $C_i$ não tem pontos interiores em comum com qualquer $C_j$ para $1 ≤ i$, $j ≤ k$ e $i ≠ j$,
|
||||||
For example, (5, 5, 5) and (4, 3, 21) are necklace triplets, while it can be shown that (2, 2, 5) is not.
|
- $C_i$ é tangente tanto a $C_{\text{in}}$ quanto a $C_{\text{out}}$ para $1 ≤ i ≤ k$,
|
||||||
<img src="https://projecteuler.net/project/images/p428_necklace.png" alt="a visual representation of a necklace triplet" />
|
- $C_i$ é tangente a $C_{i + 1}$ para $1 ≤ i < k$, e
|
||||||
|
- $C_k$ é tangente a $C_1$.
|
||||||
|
|
||||||
Let T(`n`) be the number of necklace triplets (`a`, `b`, `c`) such that `a`, `b` and `c` are positive integers, and `b` ≤ `n`. For example, T(1) = 9, T(20) = 732 and T(3000) = 438106.
|
Por exemplo, (5, 5, 5) e (4, 3, 21) são trios do colar, enquanto é possível mostrar que (2, 2, 5) não é.
|
||||||
|
|
||||||
Find T(1 000 000 000).
|
<img class="img-responsive center-block" alt="uma representação visual de um trio de colar" src="https://cdn.freecodecamp.org/curriculum/project-euler/necklace-of-circles.png" style="background-color: white; padding: 10px;" />
|
||||||
|
|
||||||
|
Considere $T(n)$ como o número de trios de colar $(a, b, c)$, tal que $a$, $b$ e $c$ sejam inteiros positivos e $b ≤ n$. Por exemplo, $T(1) = 9$, $T(20) = 732$ and $T(3.000) = 438.106$.
|
||||||
|
|
||||||
|
Encontre $T(1.000.000.000)$.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`necklace(1000000000)` should return 747215561862.
|
`necklace(1000000000)` deve retornar `747215561862`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(necklace(1000000000), 747215561862);
|
assert.strictEqual(necklace(1000000000), 747215561862);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f5191000cf542c51002c
|
id: 5900f5191000cf542c51002c
|
||||||
title: 'Problem 429: Sum of squares of unitary divisors'
|
title: 'Problema 429: Soma dos quadrados dos divisores unitários'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302099
|
forumTopicId: 302099
|
||||||
dashedName: problem-429-sum-of-squares-of-unitary-divisors
|
dashedName: problem-429-sum-of-squares-of-unitary-divisors
|
||||||
@ -8,22 +8,22 @@ dashedName: problem-429-sum-of-squares-of-unitary-divisors
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
A unitary divisor d of a number n is a divisor of n that has the property gcd(d, n/d) = 1.
|
Um divisor unitário $d$ de um número $n$ é um divisor de $n$ que tem a propriedade $gcd(d, \frac{n}{d}) = 1$.
|
||||||
|
|
||||||
The unitary divisors of 4! = 24 are 1, 3, 8 and 24.
|
Os divisores unitários de $4! = 24$ são 1, 3, 8 e 24.
|
||||||
|
|
||||||
The sum of their squares is 12 + 32 + 82 + 242 = 650.
|
A soma de seus quadrados é $12 + 32 + 82 + 242 = 650$.
|
||||||
|
|
||||||
Let S(n) represent the sum of the squares of the unitary divisors of n. Thus S(4!)=650.
|
Considere $S(n)$ como representando a soma dos quadrados dos divisores unitários de $n$. Portanto, $S(4!) = 650$.
|
||||||
|
|
||||||
Find S(100 000 000!) modulo 1 000 000 009.
|
Encontre $S(100.000.000!)$ modulo $1.000.000.009$.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler429()` should return 98792821.
|
`sumSquaresOfUnitaryDivisors()` deve retornar `98792821`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler429(), 98792821);
|
assert.strictEqual(sumSquaresOfUnitaryDivisors(), 98792821);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -31,12 +31,12 @@ assert.strictEqual(euler429(), 98792821);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler429() {
|
function sumSquaresOfUnitaryDivisors() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler429();
|
sumSquaresOfUnitaryDivisors();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -8,9 +8,9 @@ dashedName: problem-43-sub-string-divisibility
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
O número 1406357289 é um número pandigital de 0 a 9 porque é composto por cada um dos dígitos de 0 a 9, mas tem também uma propriedade de divisão de suas substrings bastante interessante.
|
O número 1406357289 é um número pandigital de 0 a 9 porque é composto por cada um dos algarismos de 0 a 9, mas tem também uma propriedade de divisão de suas substrings bastante interessante.
|
||||||
|
|
||||||
Considere que $d_1$ seja o 1º dígito, $d_2$ seja o 2º dígito, e assim por diante. Desta forma, podemos perceber o seguinte:
|
Considere que $d_1$ seja o 1º algarismo, $d_2$ seja o 2º algarismo, e assim por diante. Desta forma, podemos perceber o seguinte:
|
||||||
|
|
||||||
- ${d_2}{d_3}{d_4} = 406$ é divisível por 2
|
- ${d_2}{d_3}{d_4} = 406$ é divisível por 2
|
||||||
- ${d_3}{d_4}{d_5} = 063$ é divisível por 3
|
- ${d_3}{d_4}{d_5} = 063$ é divisível por 3
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f51a1000cf542c51002d
|
id: 5900f51a1000cf542c51002d
|
||||||
title: 'Problem 430: Range flips'
|
title: 'Problema 430: Viradas em intervalo'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302101
|
forumTopicId: 302101
|
||||||
dashedName: problem-430-range-flips
|
dashedName: problem-430-range-flips
|
||||||
@ -8,24 +8,26 @@ dashedName: problem-430-range-flips
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
N disks are placed in a row, indexed 1 to N from left to right.
|
$N$ discos são colocados em uma linha, indexados de 1 a $N$, da esquerda para a direita.
|
||||||
|
|
||||||
Each disk has a black side and white side. Initially all disks show their white side.
|
Cada disco tem um lado preto e um lado branco. Inicialmente, todos os discos mostram seu lado branco.
|
||||||
|
|
||||||
At each turn, two, not necessarily distinct, integers A and B between 1 and N (inclusive) are chosen uniformly at random. All disks with an index from A to B (inclusive) are flipped.
|
A cada movimento, dois, não necessariamente distintos, números inteiros $A$ e $B$ entre 1 e $N$ (inclusive) são escolhidos uniformemente e aleatoriamente. Todos os discos com um índice de $A$ a $B$ (inclusive) são virados.
|
||||||
|
|
||||||
The following example shows the case N = 8. At the first turn A = 5 and B = 2, and at the second turn A = 4 and B = 6.
|
O exemplo a seguir mostra o caso de $N = 8$. No primeiro movimento, $A = 5$ e $B = 2$. No segundo movimento, $A = 4$ e $B = 6$.
|
||||||
|
|
||||||
Let E(N, M) be the expected number of disks that show their white side after M turns. We can verify that E(3, 1) = 10/9, E(3, 2) = 5/3, E(10, 4) ≈ 5.157 and E(100, 10) ≈ 51.893.
|
<img class="img-responsive center-block" alt="exemplo para N = 8, com o primeiro movimento A = 5 e B = 2 e o segundo movimento A = 4 e B = 6" src="https://cdn.freecodecamp.org/curriculum/project-euler/range-flips.gif" style="background-color: white; padding: 10px;" />
|
||||||
|
|
||||||
Find E(1010, 4000). Give your answer rounded to 2 decimal places behind the decimal point.
|
Considere $E(N, M)$ como o número de discos esperado mostrando seu lado branco após $M$ movimentos. Podemos verificar que $E(3, 1) = \frac{10}{9}$, $E(3, 2) = \frac{5}{3}$, $E(10, 4) ≈ 5.157$ e $E(100, 10) ≈ 51.893$.
|
||||||
|
|
||||||
|
Encontre $E({10}^{10}, 4000)$. Dê sua resposta arredondada para 2 casas depois da vírgula.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler430()` should return 5000624921.38.
|
`rangeFlips()` deve retornar `5000624921.38`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler430(), 5000624921.38);
|
assert.strictEqual(rangeFlips(), 5000624921.38);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -33,12 +35,12 @@ assert.strictEqual(euler430(), 5000624921.38);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler430() {
|
function rangeFlips() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler430();
|
rangeFlips();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f51b1000cf542c51002e
|
id: 5900f51b1000cf542c51002e
|
||||||
title: 'Problem 431: Square Space Silo'
|
title: 'Problema 431: Silo de espaço quadrado'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302102
|
forumTopicId: 302102
|
||||||
dashedName: problem-431-square-space-silo
|
dashedName: problem-431-square-space-silo
|
||||||
@ -8,22 +8,24 @@ dashedName: problem-431-square-space-silo
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Fred the farmer arranges to have a new storage silo installed on his farm and having an obsession for all things square he is absolutely devastated when he discovers that it is circular. Quentin, the representative from the company that installed the silo, explains that they only manufacture cylindrical silos, but he points out that it is resting on a square base. Fred is not amused and insists that it is removed from his property.
|
Fred, o agricultor, organiza a instalação de um novo silo de armazenamento na sua fazenda e tem uma obsessão por tudo o que é quadrado. Ele fica absolutamente deprimido quando descobre que o silo é circular. Quentin, o representante da empresa que instalou o silo, explica que eles apenas fabricam silos cilíndricos, mas chama a atenção para o fato de que eles estão sobre uma base quadrada. Fred não fica feliz e insiste que seja removido da sua propriedade.
|
||||||
|
|
||||||
Quick thinking Quentin explains that when granular materials are delivered from above a conical slope is formed and the natural angle made with the horizontal is called the angle of repose. For example if the angle of repose, $\\alpha = 30$ degrees, and grain is delivered at the centre of the silo then a perfect cone will form towards the top of the cylinder. In the case of this silo, which has a diameter of 6m, the amount of space wasted would be approximately 32.648388556 m3. However, if grain is delivered at a point on the top which has a horizontal distance of $x$ metres from the centre then a cone with a strangely curved and sloping base is formed. He shows Fred a picture.
|
Pensando rápido, Quentin explica que, quando os materiais dos grãos são entregues por cima, uma inclinação cônica é formada. O ângulo natural feito com a horizontal é chamado de ângulo de repouso. Por exemplo, se o ângulo de repouso, $\alpha = 30°$, e se os grãos forem entregues no centro do silo, então um cone perfeito se formará em direção ao topo do cilindro. No caso deste silo, que tem um diâmetro de 6 m, a quantidade de espaço desperdiçado seria de aproximadamente 32,648388556 m<sup>3</sup>. No entanto, se o grão for entregue em um ponto na parte superior que tem uma distância horizontal de $x$ metros do centro, então um cone com uma base estranhamente curvada e inclinada é formado. Ele mostra uma foto para Fred.
|
||||||
|
|
||||||
We shall let the amount of space wasted in cubic metres be given by $V(x)$. If $x = 1.114785284$, which happens to have three squared decimal places, then the amount of space wasted, $V(1.114785284) \\approx 36$. Given the range of possible solutions to this problem there is exactly one other option: $V(2.511167869) \\approx 49$. It would be like knowing that the square is king of the silo, sitting in splendid glory on top of your grain.
|
<img class="img-responsive center-block" alt="imagem apresentando a formação do cone perfeito na direção do topo do cilindro" src="https://cdn.freecodecamp.org/curriculum/project-euler/square-space-silo.png" style="background-color: white; padding: 10px;" />
|
||||||
|
|
||||||
Fred's eyes light up with delight at this elegant resolution, but on closer inspection of Quentin's drawings and calculations his happiness turns to despondency once more. Fred points out to Quentin that it's the radius of the silo that is 6 metres, not the diameter, and the angle of repose for his grain is 40 degrees. However, if Quentin can find a set of solutions for this particular silo then he will be more than happy to keep it.
|
Vamos considerar a quantidade de espaço desperdiçada em metros cúbicos como $V(x)$. Se $x = 1.114.785.284$, que tem três casas decimais quadradas, a quantidade de espaço desperdiçada, $V(1.114.785.284) \approx 36$. Dada a amplitude de soluções possíveis para este problema, há exatamente uma outra opção: $V(2.511.167.869) \approx 49$. Seria como se soubéssemos que o quadrado é o rei do silo, sentado em glória esplêndida em cima de seus grãos.
|
||||||
|
|
||||||
If Quick thinking Quentin is to satisfy frustratingly fussy Fred the farmer's appetite for all things square then determine the values of $x$ for all possible square space wastage options and calculate $\\sum x$ correct to 9 decimal places.
|
Os olhos de Fred iluminam-se de prazer com esta resolução elegante, mas na inspeção mais atenta dos desenhos e cálculos de Quentin, sua felicidade virou desânimo mais uma vez. Fred aponta para Quentin que é o raio do silo que é 6 metros, não o diâmetro, e o ângulo de repouso para seus grãos é de 40°. No entanto, se Quentin conseguir encontrar uma série de soluções para este silo em particular, ele manterá o silo com prazer.
|
||||||
|
|
||||||
|
Se Quentin pensar rápido e quiser satisfazer Fred, o fazendeiro frustrado com paixão por todas as coisas quadradas, ele precisa determinar os valores de $x$ para todas as opções de desperdício de espaço quadrado e calcular $\sum x$ corretamente para 9 casas decimais.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler431()` should return 23.386029052.
|
`squareSpaceSilo()` deve retornar `23.386029052`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler431(), 23.386029052);
|
assert.strictEqual(squareSpaceSilo(), 23.386029052);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -31,12 +33,12 @@ assert.strictEqual(euler431(), 23.386029052);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler431() {
|
function squareSpaceSilo() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler431();
|
squareSpaceSilo();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f51e1000cf542c510030
|
id: 5900f51e1000cf542c510030
|
||||||
title: 'Problem 432: Totient sum'
|
title: 'Problema 432: Soma de totientes'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302103
|
forumTopicId: 302103
|
||||||
dashedName: problem-432-totient-sum
|
dashedName: problem-432-totient-sum
|
||||||
@ -8,18 +8,18 @@ dashedName: problem-432-totient-sum
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Let S(n,m) = ∑φ(n × i) for 1 ≤ i ≤ m. (φ is Euler's totient function)
|
Considere $S(n, m) = \sum φ(n × i)$ para $1 ≤ i ≤ m$. ($φ$ é a função totiente de Euler)
|
||||||
|
|
||||||
You are given that S(510510,106 )= 45480596821125120.
|
Você é informado de que $S(510.510,{10}^6) = 45.480.596.821.125.120$.
|
||||||
|
|
||||||
Find S(510510,1011). Give the last 9 digits of your answer.
|
Encontre $S(510.510, {10}^{11})$. Dê os últimos 9 algarismos da sua resposta.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler432()` should return 754862080.
|
`totientSum()` deve retornar `754862080`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler432(), 754862080);
|
assert.strictEqual(totientSum(), 754862080);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -27,12 +27,12 @@ assert.strictEqual(euler432(), 754862080);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler432() {
|
function totientSum() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler432();
|
totientSum();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f51d1000cf542c51002f
|
id: 5900f51d1000cf542c51002f
|
||||||
title: 'Problem 433: Steps in Euclid''s algorithm'
|
title: 'Problema 433: Etapas no algoritmo de Euclides'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302104
|
forumTopicId: 302104
|
||||||
dashedName: problem-433-steps-in-euclids-algorithm
|
dashedName: problem-433-steps-in-euclids-algorithm
|
||||||
@ -8,22 +8,26 @@ dashedName: problem-433-steps-in-euclids-algorithm
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Let E(x0, y0) be the number of steps it takes to determine the greatest common divisor of x0 and y0 with Euclid's algorithm. More formally:x1 = y0, y1 = x0 mod y0xn = yn-1, yn = xn-1 mod yn-1
|
Considere $E(x_0, y_0)$ como o número de etapas necessárias para determinar o máximo divisor comum de $x_0$ e $y_0$ com o algoritmo de Euclides. Mais formalmente:
|
||||||
|
|
||||||
E(x0, y0) is the smallest n such that yn = 0.
|
$$\begin{align} & x_1 = y_0, y_1 = x_0\bmod y_0 \\\\ & x_n = y_{n - 1}, y_n = x_{n - 1}\bmod y_{n - 1} \end{align}$$
|
||||||
|
|
||||||
We have E(1,1) = 1, E(10,6) = 3 and E(6,10) = 4.
|
$E(x_0, y_0)$ é o menor $n$, tal que $y_n = 0$.
|
||||||
|
|
||||||
Define S(N) as the sum of E(x,y) for 1 ≤ x,y ≤ N. We have S(1) = 1, S(10) = 221 and S(100) = 39826.
|
Temos $E(1, 1) = 1$, $E(10, 6) = 3$ e $E(6, 10) = 4$.
|
||||||
|
|
||||||
Find S(5·106).
|
Defina $S(N)$ como a soma de $E(x, y)$ para $1 ≤ x$, $y ≤ N$.
|
||||||
|
|
||||||
|
Temos $S(1) = 1$, $S(10) = 221$ e $S(100) = 39.826$.
|
||||||
|
|
||||||
|
Encontre $S(5 \times {10}^6)$.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler433()` should return 326624372659664.
|
`stepsInEuclidsAlgorithm()` deve retornar `326624372659664`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler433(), 326624372659664);
|
assert.strictEqual(stepsInEuclidsAlgorithm(), 326624372659664);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -31,12 +35,12 @@ assert.strictEqual(euler433(), 326624372659664);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler433() {
|
function stepsInEuclidsAlgorithm() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler433();
|
stepsInEuclidsAlgorithm();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f51f1000cf542c510031
|
id: 5900f51f1000cf542c510031
|
||||||
title: 'Problem 434: Rigid graphs'
|
title: 'Problema 434: Grafos rígidos'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302105
|
forumTopicId: 302105
|
||||||
dashedName: problem-434-rigid-graphs
|
dashedName: problem-434-rigid-graphs
|
||||||
@ -8,28 +8,42 @@ dashedName: problem-434-rigid-graphs
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Recall that a graph is a collection of vertices and edges connecting the vertices, and that two vertices connected by an edge are called adjacent.
|
Lembre-se de que um grafo é uma coleção de vértices e bordas conectando os vértices, e que dois vértices conectados por uma aresta são chamados de adjacentes.
|
||||||
|
|
||||||
Graphs can be embedded in Euclidean space by associating each vertex with a point in the Euclidean space.
|
Grafos podem ser incorporados no espaço euclideano associando cada vértice com um ponto nesse espaço.
|
||||||
|
|
||||||
A flexible graph is an embedding of a graph where it is possible to move one or more vertices continuously so that the distance between at least two nonadjacent vertices is altered while the distances between each pair of adjacent vertices is kept constant.
|
Um grafo flexível é uma incorporação de um grafo no qual é possível mover um ou mais vértices continuamente para que a distância entre pelo menos dois vértices não adjacentes seja alterada enquanto as distâncias entre cada par de vértices adjacentes seja mantida constante.
|
||||||
|
|
||||||
A rigid graph is an embedding of a graph which is not flexible.
|
Um grafo rígido é uma incorporação de um grafo que não é flexível.
|
||||||
|
|
||||||
Informally, a graph is rigid if by replacing the vertices with fully rotating hinges and the edges with rods that are unbending and inelastic, no parts of the graph can be moved independently from the rest of the graph.
|
Informalmente, um grafo é rígido se, ao substituir os vértices por dobradiças de rotação completa e as arestas por hastes não elásticas e não curvas, nenhuma parte do grafo poderá se mover de modo independente do resto do grafo.
|
||||||
|
|
||||||
The grid graphs embedded in the Euclidean plane are not rigid, as the following animation demonstrates: However, one can make them rigid by adding diagonal edges to the cells. For example, for the 2x3 grid graph, there are 19 ways to make the graph rigid: Note that for the purposes of this problem, we do not consider changing the orientation of a diagonal edge or adding both diagonal edges to a cell as a different way of making a grid graph rigid.
|
Os grafos de grade incorporados no plano euclideano não são rígidos, como demonstra a animação a seguir:
|
||||||
|
|
||||||
Let R(m,n) be the number of ways to make the m × n grid graph rigid. E.g. R(2,3) = 19 and R(5,5) = 23679901
|
<img class="img-responsive center-block" alt="animação mostrando que os grafos de grade não são rígidos no plano euclideano" src="https://cdn.freecodecamp.org/curriculum/project-euler/rigid-graphs-1.gif" style="background-color: white; padding: 10px;" />
|
||||||
|
|
||||||
Define S(N) as ∑R(i,j) for 1 ≤ i, j ≤ N. E.g. S(5) = 25021721. Find S(100), give your answer modulo 1000000033
|
No entanto, é possível torná-los rígidos adicionando arestas diagonais às células. Por exemplo, para o grafo de grade 2x3, há 19 maneiras de tornar o grafo rígido:
|
||||||
|
|
||||||
|
<img class="img-responsive center-block" alt="19 maneiras de tornar o grafo de grade 2x3 rígido" src="https://cdn.freecodecamp.org/curriculum/project-euler/rigid-graphs-2.png" style="background-color: white; padding: 10px;" />
|
||||||
|
|
||||||
|
Observe que, para fins deste problema, não consideramos a troca da orientação de uma aresta diagonal nem adicionar arestas diagonais a uma célula como uma forma diferente de fazer um grafo de grade rígido.
|
||||||
|
|
||||||
|
Considere $R(m, n)$ como o número de maneiras de tornar um grafo de grade $m × n$ rígido.
|
||||||
|
|
||||||
|
Ex: $R(2, 3) = 19$ e $R(5, 5) = 23.679.901$.
|
||||||
|
|
||||||
|
Defina $S(N)$ como $\sum R(i, j)$ para $1 ≤ i$, $j ≤ N$.
|
||||||
|
|
||||||
|
Ex: $S(5) = 25.021.721$.
|
||||||
|
|
||||||
|
Encontre $S(100)$, dê sua resposta modulo $1.000.000.033$.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler434()` should return 863253606.
|
`rigidGraphs()` deve retornar `863253606`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler434(), 863253606);
|
assert.strictEqual(rigidGraphs(), 863253606);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -37,12 +51,12 @@ assert.strictEqual(euler434(), 863253606);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler434() {
|
function rigidGraphs() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler434();
|
rigidGraphs();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f5201000cf542c510032
|
id: 5900f5201000cf542c510032
|
||||||
title: 'Problem 435: Polynomials of Fibonacci numbers'
|
title: 'Problema 435: Polinômios dos números de Fibonacci'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302106
|
forumTopicId: 302106
|
||||||
dashedName: problem-435-polynomials-of-fibonacci-numbers
|
dashedName: problem-435-polynomials-of-fibonacci-numbers
|
||||||
@ -8,20 +8,20 @@ dashedName: problem-435-polynomials-of-fibonacci-numbers
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
The Fibonacci numbers {fn, n ≥ 0} are defined recursively as fn = fn-1 + fn-2 with base cases f0 = 0 and f1 = 1.
|
Os números de Fibonacci $\\{f_n, n ≥ 0\\}$ são definidos recursivamente como $f_n = f_{n - 1} + f_{n - 2}$ com casos de base $f_0 = 0$ e $f_1 = 1$.
|
||||||
|
|
||||||
Define the polynomials {Fn, n ≥ 0} as Fn(x) = ∑fixi for 0 ≤ i ≤ n.
|
Defina os polinômios $\\{F_n, n ≥ 0\\}$ como $F_n(x) = \displaystyle\sum_{i = 0}^n f_ix^i$.
|
||||||
|
|
||||||
For example, F7(x) = x + x2 + 2x3 + 3x4 + 5x5 + 8x6 + 13x7, and F7(11) = 268357683.
|
Por exemplo, $F_7(x) = x + x^2 + 2x^3 + 3x^4 + 5x^5 + 8x^6 + 13x^7$ e $F_7(11) = 268.357.683$.
|
||||||
|
|
||||||
Let n = 1015. Find the sum \[∑0≤x≤100 Fn(x)] mod 1307674368000 (= 15!).
|
Considere $n = {10}^{15}$. Encontre a soma $\displaystyle\sum_{x = 0}^{100} F_n(x)$ e dê sua resposta modulo $1.307.674.368.000 \\, (= 15!)$.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler435()` should return 252541322550.
|
`polynomialsOfFibonacciNumbers()` deve retornar `252541322550`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler435(), 252541322550);
|
assert.strictEqual(polynomialsOfFibonacciNumbers(), 252541322550);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -29,12 +29,12 @@ assert.strictEqual(euler435(), 252541322550);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler435() {
|
function polynomialsOfFibonacciNumbers() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler435();
|
polynomialsOfFibonacciNumbers();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f5221000cf542c510033
|
id: 5900f5221000cf542c510033
|
||||||
title: 'Problem 436: Unfair wager'
|
title: 'Problema 436: Aposta injusta'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302107
|
forumTopicId: 302107
|
||||||
dashedName: problem-436-unfair-wager
|
dashedName: problem-436-unfair-wager
|
||||||
@ -8,30 +8,32 @@ dashedName: problem-436-unfair-wager
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Julie proposes the following wager to her sister Louise.
|
Julie propõe a seguinte aposta à sua irmã Louise.
|
||||||
|
|
||||||
She suggests they play a game of chance to determine who will wash the dishes.
|
Ela sugere que joguem um jogo de azar para determinar quem lavará a louça.
|
||||||
|
|
||||||
For this game, they shall use a generator of independent random numbers uniformly distributed between 0 and 1.
|
Para esse jogo, elas usarão um gerador de números aleatórios independentes distribuídos uniformemente entre 0 e 1.
|
||||||
|
|
||||||
The game starts with S = 0.
|
O jogo começa com $S = 0$.
|
||||||
|
|
||||||
The first player, Louise, adds to S different random numbers from the generator until S > 1 and records her last random number 'x'.
|
O primeiro jogador, Louise, adiciona a $S$ números aleatórios diferentes do gerador até $S > 1$ e registra seu último número aleatório '$x$'.
|
||||||
|
|
||||||
The second player, Julie, continues adding to S different random numbers from the generator until S > 2 and records her last random number 'y'.
|
O segundo jogador, Julie, continua a adicionar a $S$ números aleatórios diferentes do gerador até $S > 2$ e registra seu último número aleatório '$y$'.
|
||||||
|
|
||||||
The player with the highest number wins and the loser washes the dishes, i.e. if y > x the second player wins.
|
O jogador com o maior número ganha e o perdedor lava a louça, ou seja, se $y > x$ o segundo jogador vence.
|
||||||
|
|
||||||
For example, if the first player draws 0.62 and 0.44, the first player turn ends since 0.62+0.44 > 1 and x = 0.44. If the second players draws 0.1, 0.27 and 0.91, the second player turn ends since 0.62+0.44+0.1+0.27+0.91 > 2 and y = 0.91. Since y > x, the second player wins.
|
Por exemplo, se o primeiro jogador tem 0,62 e 0,44, a vez do primeiro jogador termina, já que $0,62 + 0,44 > 1$ e $x = 0,44$. Se o segundo jogador tem 0,1, 0,27 e 0,91, a vez do segundo jogador termina, já que $0,62 + 0,44 + 0,1 + 0,27 + 0,91 > 2$ e $y = 0,91$. Como $y > x$, o segundo jogador vence.
|
||||||
|
|
||||||
Louise thinks about it for a second, and objects: "That's not fair". What is the probability that the second player wins? Give your answer rounded to 10 places behind the decimal point in the form 0.abcdefghij
|
Louise pensa por uns instantes e declara: "Isso não é justo".
|
||||||
|
|
||||||
|
Qual é a probabilidade de o segundo jogador vencer? Arredonde sua resposta para até 10 casas decimais usando o formato 0.abcdefghij
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler436()` should return 0.5276662759.
|
`unfairWager()` deve retornar `0.5276662759`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler436(), 0.5276662759);
|
assert.strictEqual(unfairWager(), 0.5276662759);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -39,12 +41,12 @@ assert.strictEqual(euler436(), 0.5276662759);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler436() {
|
function unfairWager() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler436();
|
unfairWager();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f5241000cf542c510036
|
id: 5900f5241000cf542c510036
|
||||||
title: 'Problem 437: Fibonacci primitive roots'
|
title: 'Problema 437: Raízes primitivas de Fibonacci'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302108
|
forumTopicId: 302108
|
||||||
dashedName: problem-437-fibonacci-primitive-roots
|
dashedName: problem-437-fibonacci-primitive-roots
|
||||||
@ -8,40 +8,28 @@ dashedName: problem-437-fibonacci-primitive-roots
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
When we calculate 8n modulo 11 for n=0 to 9 we get: 1, 8, 9, 6, 4, 10, 3, 2, 5, 7.
|
Quando calculamos $8^n$ modulo 11 para $n = 0$ a 9, obtemos: 1, 8, 9, 6, 4, 10, 3, 2, 5, 7.
|
||||||
|
|
||||||
As we see all possible values from 1 to 10 occur. So 8 is a primitive root of 11.
|
Como vemos todos os valores possíveis, de 1 a 10, ocorrem. Portanto, 8 é uma raiz primitiva de 11.
|
||||||
|
|
||||||
But there is more:
|
Mas há mais:
|
||||||
|
|
||||||
If we take a closer look we see:
|
Se olharmos mais de perto:
|
||||||
|
|
||||||
1+8=9
|
$$\begin{align} & 1 + 8 = 9 \\\\ & 8 + 9 = 17 ≡ 6\bmod 11 \\\\ & 9 + 6 = 15 ≡ 4\bmod 11 \\\\ & 6 + 4 = 10 \\\\ & 4 + 10 = 14 ≡ 3\bmod 11 \\\\ & 10 + 3 = 13 ≡ 2\bmod 11 \\\\ & 3 + 2 = 5 \\\\ & 2 + 5 = 7 \\\\ & 5 + 7 = 12 ≡ 1\bmod 11. \end{align}$$
|
||||||
|
|
||||||
8+9=17≡6 mod 11
|
Portanto, as potências de 8 mod 11 são cíclicas com o período de 10 e $8^n + 8^{n + 1} ≡ 8^{n + 2} (\text{mod } 11)$. 8 é chamado de raiz primitiva de Fibonacci de 11.
|
||||||
|
|
||||||
9+6=15≡4 mod 11
|
Nem todo número primo tem uma raiz primitiva de Fibonacci. Há 323 números primos menores que 10000 com uma ou mais raízes primitivas de Fibonacci e a soma destes primos é 1480491.
|
||||||
|
|
||||||
6+4=10
|
Calcule a soma dos números primos inferiores a $100.000.000$ com pelo menos uma raiz primitiva de Fibonacci.
|
||||||
|
|
||||||
4+10=14≡3 mod 11
|
|
||||||
|
|
||||||
10+3=13≡2 mod 11
|
|
||||||
|
|
||||||
3+2=5
|
|
||||||
|
|
||||||
2+5=7
|
|
||||||
|
|
||||||
5+7=12≡1 mod 11.
|
|
||||||
|
|
||||||
So the powers of 8 mod 11 are cyclic with period 10, and 8n + 8n+1 ≡ 8n+2 (mod 11). 8 is called a Fibonacci primitive root of 11. Not every prime has a Fibonacci primitive root. There are 323 primes less than 10000 with one or more Fibonacci primitive roots and the sum of these primes is 1480491. Find the sum of the primes less than 100,000,000 with at least one Fibonacci primitive root.
|
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler437()` should return 74204709657207.
|
`fibonacciPrimitiveRoots()` deve retornar `74204709657207`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler437(), 74204709657207);
|
assert.strictEqual(fibonacciPrimitiveRoots(), 74204709657207);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -49,12 +37,12 @@ assert.strictEqual(euler437(), 74204709657207);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler437() {
|
function fibonacciPrimitiveRoots() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler437();
|
fibonacciPrimitiveRoots();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f5231000cf542c510034
|
id: 5900f5231000cf542c510034
|
||||||
title: 'Problem 438: Integer part of polynomial equation''s solutions'
|
title: 'Problema 438: Parte inteira das soluções da equação polinomial'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302109
|
forumTopicId: 302109
|
||||||
dashedName: problem-438-integer-part-of-polynomial-equations-solutions
|
dashedName: problem-438-integer-part-of-polynomial-equations-solutions
|
||||||
@ -8,20 +8,27 @@ dashedName: problem-438-integer-part-of-polynomial-equations-solutions
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
For an n-tuple of integers t = (a1, ..., an), let (x1, ..., xn) be the solutions of the polynomial equation xn + a1xn-1 + a2xn-2 + ... + an-1x + an = 0.
|
Para uma tupla $n$ de números inteiros $t = (a_1, \ldots, a_n)$, considere $(x_1, \ldots, x_n)$ como as soluções da equação polinomial $x^n + a_1x^{n - 1} + a_2x^{n - 2} + \ldots + a_{n - 1}x + a_n = 0$.
|
||||||
|
|
||||||
Consider the following two conditions: x1, ..., xn are all real. If x1, ..., xn are sorted, ⌊xi⌋ = i for 1 ≤ i ≤ n. (⌊·⌋: floor function.)
|
Considere as duas condições a seguir:
|
||||||
|
|
||||||
In the case of n = 4, there are 12 n-tuples of integers which satisfy both conditions. We define S(t) as the sum of the absolute values of the integers in t. For n = 4 we can verify that ∑S(t) = 2087 for all n-tuples t which satisfy both conditions.
|
- $x_1, \ldots, x_n$ são todos reais.
|
||||||
|
- Se $x_1, ..., x_n$ estiverem ordenados, $⌊x_i⌋ = i$ para $1 ≤ i ≤ n$. ($⌊·⌋:$ função de piso.)
|
||||||
|
|
||||||
Find ∑S(t) for n = 7.
|
No caso de $n = 4$, há 12 tuplas $n$ de números inteiros que satisfazem ambas as condições.
|
||||||
|
|
||||||
|
Definimos $S(t)$ como a soma de valores absolutos dos números inteiros em $t$.
|
||||||
|
|
||||||
|
Para $n = 4$ podemos verificar que $\sum S(t) = 2087$ para todas as tuplas $n$ t que satisfazem ambas as condições.
|
||||||
|
|
||||||
|
Encontre a $\sum S(t)$ para $n = 7$.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler438()` should return 2046409616809.
|
`polynomialIntegerPart()` deve retornar `2046409616809`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler438(), 2046409616809);
|
assert.strictEqual(polynomialIntegerPart(), 2046409616809);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -29,12 +36,12 @@ assert.strictEqual(euler438(), 2046409616809);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler438() {
|
function polynomialIntegerPart() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler438();
|
polynomialIntegerPart();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f5231000cf542c510035
|
id: 5900f5231000cf542c510035
|
||||||
title: 'Problem 439: Sum of sum of divisors'
|
title: 'Problema 439: Soma da soma dos divisores'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302110
|
forumTopicId: 302110
|
||||||
dashedName: problem-439-sum-of-sum-of-divisors
|
dashedName: problem-439-sum-of-sum-of-divisors
|
||||||
@ -8,20 +8,22 @@ dashedName: problem-439-sum-of-sum-of-divisors
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Let d(k) be the sum of all divisors of k.
|
Considere $d(k)$ como a soma de todos os divisores de $k$.
|
||||||
|
|
||||||
We define the function S(N) = ∑1≤i≤N ∑1≤j≤Nd(i·j).
|
Definimos a função $S(N) = \sum_{i = 1}^N \sum_{j = 1}^N d(i \times j)$.
|
||||||
|
|
||||||
For example, S(3) = d(1) + d(2) + d(3) + d(2) + d(4) + d(6) + d(3) + d(6) + d(9) = 59.
|
Por exemplo, $S(3) = d(1) + d(2) + d(3) + d(2) + d(4) + d(6) + d(3) + d(6) + d(9) = 59$.
|
||||||
|
|
||||||
You are given that S(103) = 563576517282 and S(105) mod 109 = 215766508. Find S(1011) mod 109.
|
Você é informado de que $S({10}^3) = 563.576.517.282$ e $S({10}^5)\bmod {10}^9 = 215.766.508$.
|
||||||
|
|
||||||
|
Encontre $S({10}^{11})\bmod {10}^9$.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler439()` should return 968697378.
|
`sumOfSumOfDivisors()` deve retornar `968697378`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler439(), 968697378);
|
assert.strictEqual(sumOfSumOfDivisors(), 968697378);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -29,12 +31,12 @@ assert.strictEqual(euler439(), 968697378);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler439() {
|
function sumOfSumOfDivisors() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler439();
|
sumOfSumOfDivisors();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f5241000cf542c510037
|
id: 5900f5241000cf542c510037
|
||||||
title: 'Problem 440: GCD and Tiling'
|
title: 'Problema 440: Máximo divisor comum e ladrilhamento'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302112
|
forumTopicId: 302112
|
||||||
dashedName: problem-440-gcd-and-tiling
|
dashedName: problem-440-gcd-and-tiling
|
||||||
@ -8,24 +8,32 @@ dashedName: problem-440-gcd-and-tiling
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
We want to tile a board of length n and height 1 completely, with either 1 × 2 blocks or 1 × 1 blocks with a single decimal digit on top:
|
Queremos preencher com ladrilhos um tabuleiro de comprimento $n$ e altura 1 completamente, com blocos de 1 × 2 ou 1 × 1 com um único algarismo decimal no topo:
|
||||||
|
|
||||||
For example, here are some of the ways to tile a board of length n = 8:
|
<img class="img-responsive center-block" alt="dez blocos 1x1 com um único algarismo decimal no topo e um bloco 1x2" src="https://cdn.freecodecamp.org/curriculum/project-euler/gcd-and-tiling-1.png" style="background-color: white; padding: 10px;" />
|
||||||
|
|
||||||
Let T(n) be the number of ways to tile a board of length n as described above.
|
Por exemplo, aqui temos algumas maneiras de ladrilhar um tabuleiro de comprimento $n = 8$:
|
||||||
|
|
||||||
For example, T(1) = 10 and T(2) = 101.
|
<img class="img-responsive center-block" alt="exemplos de maneiras de ladrilhar um tabuleiro de comprimento n = 8" src="https://cdn.freecodecamp.org/curriculum/project-euler/gcd-and-tiling-2.png" style="background-color: white; padding: 10px;" />
|
||||||
|
|
||||||
Let S(L) be the triple sum ∑a,b,c gcd(T(ca), T(cb)) for 1 ≤ a, b, c ≤ L. For example: S(2) = 10444 S(3) = 1292115238446807016106539989 S(4) mod 987 898 789 = 670616280.
|
Considere $T(n)$ como o número de maneiras de ladrilhar um tabuleiro de comprimento $n$, como descrito acima.
|
||||||
|
|
||||||
Find S(2000) mod 987 898 789.
|
Por exemplo, $T(1) = 10$ e $T(2) = 101$.
|
||||||
|
|
||||||
|
Considere $S(L)$ como a soma tripla $\sum_{a, b, c} gcd(T(c^a), T(c^b))$ para $1 ≤ a, b, c ≤ L$.
|
||||||
|
|
||||||
|
Por exemplo:
|
||||||
|
|
||||||
|
$$\begin{align} & S(2) = 10.444 \\\\ & S(3) = 1.292.115.238.446.807.016.106.539.989 \\\\ & S(4)\bmod 987.898.789 = 670.616.280. \end{align}$$
|
||||||
|
|
||||||
|
Encontre $S(2000)\bmod 987.898.789$.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler440()` should return 970746056.
|
`gcdAndTiling()` deve retornar `970746056`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler440(), 970746056);
|
assert.strictEqual(gcdAndTiling(), 970746056);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -33,12 +41,12 @@ assert.strictEqual(euler440(), 970746056);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler440() {
|
function gcdAndTiling() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler440();
|
gcdAndTiling();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f5261000cf542c510038
|
id: 5900f5261000cf542c510038
|
||||||
title: 'Problem 441: The inverse summation of coprime couples'
|
title: 'Problema 441: A soma inversa de pares de coprimos'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302113
|
forumTopicId: 302113
|
||||||
dashedName: problem-441-the-inverse-summation-of-coprime-couples
|
dashedName: problem-441-the-inverse-summation-of-coprime-couples
|
||||||
@ -8,20 +8,24 @@ dashedName: problem-441-the-inverse-summation-of-coprime-couples
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
For an integer M, we define R(M) as the sum of 1/(p·q) for all the integer pairs p and q which satisfy all of these conditions:
|
Para um número inteiro $M$, definimos $R(M)$ como a soma de $\frac{1}{p·q}$ para todos os pares de números inteiros $p$ e $q$ que satisfazem todas essas condições:
|
||||||
|
|
||||||
1 ≤ p < q ≤ M p + q ≥ M p and q are coprime.
|
- $1 ≤ p < q ≤ M$
|
||||||
|
- $p + q ≥ M$
|
||||||
|
- $p$ e $q$ são números coprimos.
|
||||||
|
|
||||||
We also define S(N) as the sum of R(i) for 2 ≤ i ≤ N. We can verify that S(2) = R(2) = 1/2, S(10) ≈ 6.9147 and S(100) ≈ 58.2962.
|
Também definimos $S(N)$ como a soma de $R(i)$ para $2 ≤ i ≤ N$.
|
||||||
|
|
||||||
Find S(107). Give your answer rounded to four decimal places.
|
Podemos verificar que $S(2) = R(2) = \frac{1}{2}$, $S(10) ≈ 6,9147$ e $S(100) ≈ 58,2962$.
|
||||||
|
|
||||||
|
Encontre $S({10}^7)$. Dê sua resposta arredondada para quatro casas decimais.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler441()` should return 5000088.8395.
|
`inverseSummationCoprimeCouples()` deve retornar `5000088.8395`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler441(), 5000088.8395);
|
assert.strictEqual(inverseSummationCoprimeCouples(), 5000088.8395);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -29,12 +33,12 @@ assert.strictEqual(euler441(), 5000088.8395);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler441() {
|
function inverseSummationCoprimeCouples() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler441();
|
inverseSummationCoprimeCouples();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f5271000cf542c510039
|
id: 5900f5271000cf542c510039
|
||||||
title: 'Problem 442: Eleven-free integers'
|
title: 'Problema 442: Inteiros sem onze'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302114
|
forumTopicId: 302114
|
||||||
dashedName: problem-442-eleven-free-integers
|
dashedName: problem-442-eleven-free-integers
|
||||||
@ -8,20 +8,20 @@ dashedName: problem-442-eleven-free-integers
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
An integer is called eleven-free if its decimal expansion does not contain any substring representing a power of 11 except 1.
|
Um número inteiro pode ser considerado sem onze se a sua expansão decimal não contém nenhuma substring representando uma potência de 11 exceto 1.
|
||||||
|
|
||||||
For example, 2404 and 13431 are eleven-free, while 911 and 4121331 are not.
|
Por exemplo, 2404 e 13431 são sem onze, enquanto 911 e 4121331 não são.
|
||||||
|
|
||||||
Let E(n) be the nth positive eleven-free integer. For example, E(3) = 3, E(200) = 213 and E(500 000) = 531563.
|
Considere $E(n)$ como o $n$º número inteiro positivo sem onze. Por exemplo, $E(3) = 3$, $E(200) = 213$ e $E(500.000) = 531.563$.
|
||||||
|
|
||||||
Find E(1018).
|
Encontre $E({10}^{18})$.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler442()` should return 1295552661530920200.
|
`elevenFreeIntegers()` deve retornar `1295552661530920200`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler442(), 1295552661530920200);
|
assert.strictEqual(elevenFreeIntegers(), 1295552661530920200);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -29,12 +29,12 @@ assert.strictEqual(euler442(), 1295552661530920200);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler442() {
|
function elevenFreeIntegers() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler442();
|
elevenFreeIntegers();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f5271000cf542c51003a
|
id: 5900f5271000cf542c51003a
|
||||||
title: 'Problem 443: GCD sequence'
|
title: 'Problema 443: Sequencias de máximos divisores comuns'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302115
|
forumTopicId: 302115
|
||||||
dashedName: problem-443-gcd-sequence
|
dashedName: problem-443-gcd-sequence
|
||||||
@ -8,24 +8,24 @@ dashedName: problem-443-gcd-sequence
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Let g(n) be a sequence defined as follows: g(4) = 13, g(n) = g(n-1) + gcd(n, g(n-1)) for n > 4.
|
Considere $g(n)$ como uma sequência definida assim:
|
||||||
|
|
||||||
The first few values are:
|
$$\begin{align} & g(4) = 13, \\\\ & g(n) = g(n-1) + gcd(n, g(n - 1)) \text{ para } n > 4. \end{align}$$
|
||||||
|
|
||||||
n 4567891011121314151617181920... g(n) 1314161718272829303132333451545560...
|
Seus primeiros valores são:
|
||||||
|
|
||||||
<!-- TODO Use MathJax -->
|
$$\begin{array}{l} n & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & \ldots \\\\ g(n) & 13 & 14 & 16 & 17 & 18 & 27 & 28 & 29 & 30 & 31 & 32 & 33 & 34 & 51 & 54 & 55 & 60 & \ldots \end{array}$$
|
||||||
|
|
||||||
You are given that g(1 000) = 2524 and g(1 000 000) = 2624152.
|
Você é informado de que $g(1.000) = 2.524$ e $g(1.000.000) = 2.624.152$.
|
||||||
|
|
||||||
Find g(1015).
|
Encontre $g({10}^{15})$.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler443()` should return 2744233049300770.
|
`gcdSequence()` deve retornar `2744233049300770`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler443(), 2744233049300770);
|
assert.strictEqual(gcdSequence(), 2744233049300770);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -33,12 +33,12 @@ assert.strictEqual(euler443(), 2744233049300770);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler443() {
|
function gcdSequence() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler443();
|
gcdSequence();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f52a1000cf542c51003b
|
id: 5900f52a1000cf542c51003b
|
||||||
title: 'Problem 444: The Roundtable Lottery'
|
title: 'Problema 444: A loteria da mesa redonda'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302116
|
forumTopicId: 302116
|
||||||
dashedName: problem-444-the-roundtable-lottery
|
dashedName: problem-444-the-roundtable-lottery
|
||||||
@ -8,29 +8,37 @@ dashedName: problem-444-the-roundtable-lottery
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
A group of p people decide to sit down at a round table and play a lottery-ticket trading game. Each person starts off with a randomly-assigned, unscratched lottery ticket. Each ticket, when scratched, reveals a whole-pound prize ranging anywhere from £1 to £p, with no two tickets alike. The goal of the game is for each person to maximize his ticket winnings upon leaving the game.
|
Um grupo de $p$ pessoas decide se sentar ao redor de uma mesa redonda e jogar um jogo de cartas colecionáveis de bilhetes de loteria. Cada pessoa começa com um bilhete de loteria não raspado atribuído a ela aleatoriamente. Cada bilhete, quando raspado, revela um prêmio que varia de £1 até £$p$, sem que dois bilhetes tenham o mesmo prêmio. O objetivo do jogo é que cada pessoa maximize os ganhos em seus bilhetes ao sair do jogo.
|
||||||
|
|
||||||
An arbitrary person is chosen to be the first player. Going around the table, each player has only one of two options:
|
Uma pessoa arbitrária é escolhida para ser o primeiro jogador. Dando a volta na mesa, cada jogador tem apenas uma de duas opções:
|
||||||
|
|
||||||
1. The player can scratch his ticket and reveal its worth to everyone at the table.
|
1. O jogador pode raspar seu bilhete e revelar o valor dele para todos na mesa.
|
||||||
2. The player can trade his unscratched ticket for a previous player's scratched ticket, and then leave the game with that ticket. The previous player then scratches his newly-acquired ticket and reveals its worth to everyone at the table.
|
2. O jogador pode trocar seu bilhete não raspado pelo bilhete raspado de um jogador anterior e, em seguida, sair do jogo com esse bilhete. O jogador anterior pode, então, raspar seu bilhete recém-adquirido e revelar o valor dele para todos na mesa.
|
||||||
|
|
||||||
The game ends once all tickets have been scratched. All players still remaining at the table must leave with their currently-held tickets.
|
O jogo termina quando todos os bilhetes tenham sido raspados. Todos os jogadores que ainda restarem à mesa têm de sair com os bilhetes que se encontram em suas mãos.
|
||||||
|
|
||||||
Assume that each player uses the optimal strategy for maximizing the expected value of his ticket winnings.
|
Assuma que cada jogador usa a estratégia ideal para maximizar o valor esperado de seus ganhos com os bilhetes.
|
||||||
|
|
||||||
Let E(p) represent the expected number of players left at the table when the game ends in a game consisting of p players (e.g. E(111) = 5.2912 when rounded to 5 significant digits).
|
Considere $E(p)$ como representando o número esperado de jogadores restantes na mesa quando o jogo termina em um jogo que consiste em $p$ jogadores (por exemplo, $E(111) = 5,2912$ quando arredondado para 5 algarismos significativos).
|
||||||
|
|
||||||
Let S1(N) = E(p) Let Sk(N) = Sk-1(p) for k > 1
|
Considere $S_1(N) = \displaystyle\sum_{p = 1}^N E(p)$.
|
||||||
|
|
||||||
Find S20(1014) and write the answer in scientific notation rounded to 10 significant digits. Use a lowercase e to separate mantissa and exponent (e.g. S3(100) = 5.983679014e5).
|
Considere $S_k(N) = \displaystyle\sum_{p = 1}^N S_{k - 1}(p)$ para $k > 1$.
|
||||||
|
|
||||||
|
Encontre $S_{20}({10}^{14})$ e escreva sua resposta como uma string em notação científica arredondada para 10 algarismos significativos. Use `e` em letra minúscula para separar a mantissa do expoente. Por exemplo, a resposta para $S_3(100)$ seria `5.983679014e5`.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler444()` should return 1.200856722e+263.
|
`roundtableLottery()` deve retornar uma string.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler444(), 1.200856722e263);
|
assert(typeof roundtableLottery() === 'string');
|
||||||
|
```
|
||||||
|
|
||||||
|
`roundtableLottery()` deve retornar a string `1.200856722e263`.
|
||||||
|
|
||||||
|
```js
|
||||||
|
assert.strictEqual(roundtableLottery(), '1.200856722e263');
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -38,12 +46,12 @@ assert.strictEqual(euler444(), 1.200856722e263);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler444() {
|
function roundtableLottery() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler444();
|
roundtableLottery();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f52a1000cf542c51003c
|
id: 5900f52a1000cf542c51003c
|
||||||
title: 'Problem 445: Retractions A'
|
title: 'Problema 445: Retrações A'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302117
|
forumTopicId: 302117
|
||||||
dashedName: problem-445-retractions-a
|
dashedName: problem-445-retractions-a
|
||||||
@ -8,20 +8,26 @@ dashedName: problem-445-retractions-a
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
For every integer n>1, the family of functions fn,a,b is defined
|
Para cada número inteiro $n > 1$, a família de funções $f_{n, a, b}$ é definida por:
|
||||||
|
|
||||||
by fn,a,b(x)≡ax+b mod n for a,b,x integer and 0
|
$f_{n, a, b}(x) ≡ ax + b\bmod n$ para $a, b, x$ sendo números inteiros e $0 \lt a \lt n$, $0 \le b \lt n$, $0 \le x \lt n$.
|
||||||
|
|
||||||
You are given that ∑ R(c) for c=C(100 000,k), and 1 ≤ k ≤99 999 ≡628701600 (mod 1 000 000 007). (C(n,k) is the binomial coefficient).
|
Chamaremos $f_{n, a, b}$ de retração se $f_{n, a, b}(f_{n, a, b}(x)) \equiv f_{n, a, b}(x)\bmod n$ para cada $0 \le x \lt n$.
|
||||||
|
|
||||||
Find ∑ R(c) for c=C(10 000 000,k), and 1 ≤k≤ 9 999 999. Give your answer modulo 1 000 000 007.
|
Considere $R(n)$ como o número de retrações para $n$.
|
||||||
|
|
||||||
|
Você é informado de que
|
||||||
|
|
||||||
|
$$\sum_{k = 1}^{99.999} R(\displaystyle\binom{100.000}{k}) \equiv 628.701.600\bmod 1.000.000.007$$
|
||||||
|
|
||||||
|
Encontre $$\sum_{k = 1}^{9.999.999} R(\displaystyle\binom{10.000.000}{k})$$ Dê sua resposta modulo $1.000.000.007$.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler445()` should return 659104042.
|
`retractionsA()` deve retornar `659104042`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler445(), 659104042);
|
assert.strictEqual(retractionsA(), 659104042);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -29,12 +35,12 @@ assert.strictEqual(euler445(), 659104042);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler445() {
|
function retractionsA() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler445();
|
retractionsA();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f52c1000cf542c51003d
|
id: 5900f52c1000cf542c51003d
|
||||||
title: 'Problem 446: Retractions B'
|
title: 'Problema 446: Retrações B'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302118
|
forumTopicId: 302118
|
||||||
dashedName: problem-446-retractions-b
|
dashedName: problem-446-retractions-b
|
||||||
@ -8,20 +8,26 @@ dashedName: problem-446-retractions-b
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
For every integer n>1, the family of functions fn,a,b is defined
|
Para cada número inteiro $n > 1$, a família de funções $f_{n, a, b}$ é definida por:
|
||||||
|
|
||||||
by fn,a,b(x)≡ax+b mod n for a,b,x integer and 0
|
$f_{n, a, b}(x) ≡ ax + b\bmod n$ para $a, b, x$ sendo números inteiros e $0 \lt a \lt n$, $0 \le b \lt n$, $0 \le x \lt n$.
|
||||||
|
|
||||||
F(N)=∑R(n4+4) for 1≤n≤N. F(1024)=77532377300600.
|
Chamaremos $f_{n, a, b}$ de retração se $f_{n, a, b}(f_{n, a, b}(x)) \equiv f_{n, a, b}(x)\bmod n$ para cada $0 \le x \lt n$.
|
||||||
|
|
||||||
Find F(107) (mod 1 000 000 007)
|
Considere $R(n)$ como o número de retrações para $n$.
|
||||||
|
|
||||||
|
$F(N) = \displaystyle\sum_{n = 1}^N R(n^4 + 4)$.
|
||||||
|
|
||||||
|
$F(1024) = 77.532.377.300.600$.
|
||||||
|
|
||||||
|
Encontre $F({10}^7)$. Dê a sua resposta modulo $1.000.000.007$.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler446()` should return 907803852.
|
`retractionsB()` deve retornar `907803852`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler446(), 907803852);
|
assert.strictEqual(retractionsB(), 907803852);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -29,12 +35,12 @@ assert.strictEqual(euler446(), 907803852);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler446() {
|
function retractionsB() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler446();
|
retractionsB();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f52c1000cf542c51003e
|
id: 5900f52c1000cf542c51003e
|
||||||
title: 'Problem 447: Retractions C'
|
title: 'Problema 447: Retrações C'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302119
|
forumTopicId: 302119
|
||||||
dashedName: problem-447-retractions-c
|
dashedName: problem-447-retractions-c
|
||||||
@ -8,20 +8,26 @@ dashedName: problem-447-retractions-c
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
For every integer n>1, the family of functions fn,a,b is defined
|
Para cada número inteiro $n > 1$, a família de funções $f_{n, a, b}$ é definida por:
|
||||||
|
|
||||||
by fn,a,b(x)≡ax+b mod n for a,b,x integer and 0
|
$f_{n, a, b}(x) ≡ ax + b\bmod n$ para $a, b, x$ sendo números inteiros e $0 \lt a \lt n$, $0 \le b \lt n$, $0 \le x \lt n$.
|
||||||
|
|
||||||
F(N)=∑R(n) for 2≤n≤N. F(107)≡638042271 (mod 1 000 000 007).
|
Chamaremos $f_{n, a, b}$ de retração se $f_{n, a, b}(f_{n, a, b}(x)) \equiv f_{n, a, b}(x)\bmod n$ para cada $0 \le x \lt n$.
|
||||||
|
|
||||||
Find F(1014) (mod 1 000 000 007).
|
Considere $R(n)$ como o número de retrações para $n$.
|
||||||
|
|
||||||
|
$F(N) = \displaystyle\sum_{n = 2}^N R(n)$.
|
||||||
|
|
||||||
|
$F({10}^7) ≡ 638.042.271\bmod 1.000.000.007$.
|
||||||
|
|
||||||
|
Encontre $F({10}^{14})$. Dê a sua resposta modulo $1.000.000.007$.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler447()` should return 530553372.
|
`retractionsC()` deve retornar `530553372`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler447(), 530553372);
|
assert.strictEqual(retractionsC(), 530553372);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -29,12 +35,12 @@ assert.strictEqual(euler447(), 530553372);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler447() {
|
function retractionsC() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler447();
|
retractionsC();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f52c1000cf542c51003f
|
id: 5900f52c1000cf542c51003f
|
||||||
title: 'Problem 448: Average least common multiple'
|
title: 'Problema 448: Mínimo múltiplo comum médio'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302120
|
forumTopicId: 302120
|
||||||
dashedName: problem-448-average-least-common-multiple
|
dashedName: problem-448-average-least-common-multiple
|
||||||
@ -8,22 +8,24 @@ dashedName: problem-448-average-least-common-multiple
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
The function lcm(a,b) denotes the least common multiple of a and b.
|
A função $lcm(a, b)$ denota o mínimo múltiplo comum de $a$ e $b$.
|
||||||
|
|
||||||
Let A(n) be the average of the values of lcm(n,i) for 1≤i≤n.
|
Considere $A(n)$ como a média dos valores de $lcm(n, i)$ para $1 ≤ i ≤ n$.
|
||||||
|
|
||||||
E.g: A(2)=(2+2)/2=2 and A(10)=(10+10+30+20+10+30+70+40+90+10)/10=32.
|
Por exemplo: $A(2) = \frac{2 + 2}{2} = 2$ e $A(10) = \frac{10 + 10 + 30 + 20 + 10 + 30 + 70 + 40 + 90 + 10}{10} = 32$.
|
||||||
|
|
||||||
Let S(n)=∑A(k) for 1≤k≤n. S(100)=122726.
|
Considere $S(n) = \sum A(k)$ para $1 ≤ k ≤ n$.
|
||||||
|
|
||||||
Find S(99999999019) mod 999999017.
|
$S(100) = 122.726$.
|
||||||
|
|
||||||
|
Encontre $S(99.999.999.019)\bmod 999.999.017$.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler448()` should return 106467648.
|
`averageLCM()` deve retornar `106467648`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler448(), 106467648);
|
assert.strictEqual(averageLCM(), 106467648);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -31,12 +33,12 @@ assert.strictEqual(euler448(), 106467648);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler448() {
|
function averageLCM() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler448();
|
averageLCM();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f52d1000cf542c510040
|
id: 5900f52d1000cf542c510040
|
||||||
title: 'Problem 449: Chocolate covered candy'
|
title: 'Problema 449: Doce coberto de chocolate'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302121
|
forumTopicId: 302121
|
||||||
dashedName: problem-449-chocolate-covered-candy
|
dashedName: problem-449-chocolate-covered-candy
|
||||||
@ -8,24 +8,22 @@ dashedName: problem-449-chocolate-covered-candy
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Phil the confectioner is making a new batch of chocolate covered candy. Each candy centre is shaped like an ellipsoid of revolution defined by the equation: b2x2 + b2y2 + a2z2 = a2b2.
|
Phil, o doceiro, está fazendo um novo lote de doce coberto de chocolate. Cada centro dos doces tem o formato de um elipsoide de revolução definido pela equação: $b^2x^2 + b^2y^2 + a^2z^2 = a^2b^2$.
|
||||||
|
|
||||||
Phil wants to know how much chocolate is needed to cover one candy centre with a uniform coat of chocolate one millimeter thick. If a=1 mm and b=1 mm, the amount of chocolate required is
|
Phil quer saber quanto chocolate é necessário para cobrir um centro de doces com uma cobertura uniforme de chocolate com um milímetro de espessura.
|
||||||
|
|
||||||
283 π mm3
|
Se $a = 1$ mm e $b = 1$ mm, a quantidade de chocolate necessária é $\frac{28}{3} \pi$ mm<sup>3</sup>
|
||||||
|
|
||||||
<!-- TODO Use MathJax -->
|
Se $a = 2$ mm e $b = 1$ mm, a quantidade de chocolate necessária é de aproximadamente 60,35475635 mm<sup>3</sup>.
|
||||||
|
|
||||||
If a=2 mm and b=1 mm, the amount of chocolate required is approximately 60.35475635 mm3.
|
Encontre a quantidade de chocolate em mm<sup>3</sup> necessária se $a = 3$ mm e $b = 1$ mm. Dê sua resposta como o número arredondado para 8 casas depois da vírgula.
|
||||||
|
|
||||||
Find the amount of chocolate in mm3 required if a=3 mm and b=1 mm. Give your answer as the number rounded to 8 decimal places behind the decimal point.
|
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler449()` should return 103.37870096.
|
`chocolateCoveredCandy()` deve retornar `103.37870096`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler449(), 103.37870096);
|
assert.strictEqual(chocolateCoveredCandy(), 103.37870096);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -33,12 +31,12 @@ assert.strictEqual(euler449(), 103.37870096);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler449() {
|
function chocolateCoveredCandy() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler449();
|
chocolateCoveredCandy();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f52e1000cf542c510041
|
id: 5900f52e1000cf542c510041
|
||||||
title: 'Problem 450: Hypocycloid and Lattice points'
|
title: 'Problema 450: Pontos da rede e hipocicloide'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302123
|
forumTopicId: 302123
|
||||||
dashedName: problem-450-hypocycloid-and-lattice-points
|
dashedName: problem-450-hypocycloid-and-lattice-points
|
||||||
@ -8,36 +8,38 @@ dashedName: problem-450-hypocycloid-and-lattice-points
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
A hypocycloid is the curve drawn by a point on a small circle rolling inside a larger circle. The parametric equations of a hypocycloid centered at the origin, and starting at the right most point is given by:
|
Um hipocicloide é a curva desenhada por um ponto em um pequeno círculo girando dentro de um círculo maior. As equações paramétricas de um hipocicloide centrado na origem e começando no ponto mais à direita são dadas por:
|
||||||
|
|
||||||
$x(t) = (R - r) \\cos(t) + r \\cos(\\frac {R - r} r t)$
|
$$x(t) = (R - r) \cos(t) + r \cos(\frac{R - r}{r}t)$$
|
||||||
|
|
||||||
$y(t) = (R - r) \\sin(t) - r \\sin(\\frac {R - r} r t)$
|
$$y(t) = (R - r) \sin(t) - r \sin(\frac{R - r}{r} t)$$
|
||||||
|
|
||||||
Where R is the radius of the large circle and r the radius of the small circle.
|
Onde $R$ é o raio do círculo grande e $r$ o raio do círculo pequeno.
|
||||||
|
|
||||||
Let $C(R, r)$ be the set of distinct points with integer coordinates on the hypocycloid with radius R and r and for which there is a corresponding value of t such that $\\sin(t)$ and $\\cos(t)$ are rational numbers.
|
Considere $C(R, r)$ como o conjunto de pontos distintos com coordenadas em números inteiros do hipocicloide com raio $R$ e $r$ e para o qual há um valor correspondente de $t$, tal que $\sin(t)$ e $\cos(t)$ são números racionais.
|
||||||
|
|
||||||
Let $S(R, r) = \\sum\_{(x,y) \\in C(R, r)} |x| + |y|$ be the sum of the absolute values of the x and y coordinates of the points in $C(R, r)$.
|
Considere $S(R, r) = \sum\_{(x,y) \in C(R, r)} |x| + |y|$ como a soma dos valores absolutos das coordenadas $x$ e $y$ dos pontos em $C(R, r)$.
|
||||||
|
|
||||||
Let $T(N) = \\sum*{R = 3}^N \\sum*{r=1}^{\\lfloor \\frac {R - 1} 2 \\rfloor} S(R, r)$ be the sum of $S(R, r)$ for R and r positive integers, $R\\leq N$ and $2r < R$.
|
Considere $T(N) = \sum_{R = 3}^N \sum_{r=1}^{\left\lfloor \frac{R - 1}{2} \right\rfloor} S(R, r)$ como a soma de $S(R, r)$ para $R$ e $r$ sendo números inteiros positivos, $R\leq N$ e $2r < R$.
|
||||||
|
|
||||||
You are given:C(3, 1) = {(3, 0), (-1, 2), (-1,0), (-1,-2)} C(2500, 1000) = {(2500, 0), (772, 2376), (772, -2376), (516, 1792), (516, -1792), (500, 0), (68, 504), (68, -504),(-1356, 1088), (-1356, -1088), (-1500, 1000), (-1500, -1000)}
|
Você é informado de que:
|
||||||
|
|
||||||
Note: (-625, 0) is not an element of C(2500, 1000) because $\\sin(t)$ is not a rational number for the corresponding values of t.
|
$$\begin{align} C(3, 1) = & \\{(3, 0), (-1, 2), (-1,0), (-1,-2)\\} \\\\ C(2500, 1000) = & \\{(2500, 0), (772, 2376), (772, -2376), (516, 1792), (516, -1792), (500, 0), (68, 504), \\\\ &(68, -504),(-1356, 1088), (-1356, -1088), (-1500, 1000), (-1500, -1000)\\} \end{align}$$
|
||||||
|
|
||||||
S(3, 1) = (|3| + |0|) + (|-1| + |2|) + (|-1| + |0|) + (|-1| + |-2|) = 10
|
**Observação:** (-625, 0) não é um elemento de $C(2500, 1000)$, pois $\sin(t)$ não é um número racional para os valores correspondentes de t.
|
||||||
|
|
||||||
T(3) = 10; T(10) = 524 ;T(100) = 580442; T(103) = 583108600.
|
$S(3, 1) = (|3| + |0|) + (|-1| + |2|) + (|-1| + |0|) + (|-1| + |-2|) = 10$
|
||||||
|
|
||||||
Find T(106).
|
$T(3) = 10$; $T(10) = 524$; $T(100) = 580.442$; $T({10}^3) = 583.108.600$.
|
||||||
|
|
||||||
|
Encontre $T({10}^6)$.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler450()` should return 583333163984220900.
|
`hypocycloidAndLatticePoints()` deve retornar `583333163984220900`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler450(), 583333163984220900);
|
assert.strictEqual(hypocycloidAndLatticePoints(), 583333163984220900);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -45,12 +47,12 @@ assert.strictEqual(euler450(), 583333163984220900);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler450() {
|
function hypocycloidAndLatticePoints() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler450();
|
hypocycloidAndLatticePoints();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f5311000cf542c510042
|
id: 5900f5311000cf542c510042
|
||||||
title: 'Problem 451: Modular inverses'
|
title: 'Problema 451: Inversas modulares'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302124
|
forumTopicId: 302124
|
||||||
dashedName: problem-451-modular-inverses
|
dashedName: problem-451-modular-inverses
|
||||||
@ -8,36 +8,28 @@ dashedName: problem-451-modular-inverses
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Consider the number 15.
|
Considere o número 15.
|
||||||
|
|
||||||
There are eight positive numbers less than 15 which are coprime to 15: 1, 2, 4, 7, 8, 11, 13, 14.
|
Há oito números positivos inferiores a 15 que são coprimos para 15: 1, 2, 4, 7, 8, 11, 13, 14.
|
||||||
|
|
||||||
The modular inverses of these numbers modulo 15 are: 1, 8, 4, 13, 2, 11, 7, 14
|
As inversas modulares desses números modulo 15 são: 1, 8, 4, 13, 2, 11, 7, 14, porque
|
||||||
|
|
||||||
because
|
$$\begin{align} & 1 \times 1\bmod 15 = 1 \\\\ & 2 \times 8 = 16\bmod 15 = 1 \\\\ & 4 \times 4 = 16\bmod 15 = 1 \\\\ & 7 \times 13 = 91\bmod 15 = 1 \\\\ & 11 \times 11 = 121\bmod 15 = 1 \\\\ & 14 \times 14 = 196\bmod 15 = 1 \end{align}$$
|
||||||
|
|
||||||
1\*1 mod 15=1
|
Considere $I(n)$ como o maior número positivo $m$ menor que $n - 1$, tal que a inversa modular de $m$ modulo $n$ é igual ao próprio $m$.
|
||||||
|
|
||||||
2\*8=16 mod 15=1
|
Portanto, $I(15) = 11$.
|
||||||
|
|
||||||
4\*4=16 mod 15=1
|
Além disso, $I(100) = 51$ e $I(7) = 1$.
|
||||||
|
|
||||||
7\*13=91 mod 15=1
|
Encontre $\sum I(n)$ para $3 ≤ n ≤ 2 \times {10}^7$
|
||||||
|
|
||||||
11\*11=121 mod 15=1
|
|
||||||
|
|
||||||
14\*14=196 mod 15=1
|
|
||||||
|
|
||||||
Let I(n) be the largest positive number m smaller than n-1 such that the modular inverse of m modulo n equals m itself. So I(15)=11. Also I(100)=51 and I(7)=1.
|
|
||||||
|
|
||||||
Find ∑I(n) for 3≤n≤2·107
|
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler451()` should return 153651073760956.
|
`modularInverses()` deve retornar `153651073760956`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler451(), 153651073760956);
|
assert.strictEqual(modularInverses(), 153651073760956);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -45,12 +37,12 @@ assert.strictEqual(euler451(), 153651073760956);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler451() {
|
function modularInverses() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler451();
|
modularInverses();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f5311000cf542c510043
|
id: 5900f5311000cf542c510043
|
||||||
title: 'Problem 452: Long Products'
|
title: 'Problema 452: Produtos longos'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302125
|
forumTopicId: 302125
|
||||||
dashedName: problem-452-long-products
|
dashedName: problem-452-long-products
|
||||||
@ -8,20 +8,20 @@ dashedName: problem-452-long-products
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Define F(m,n) as the number of n-tuples of positive integers for which the product of the elements doesn't exceed m.
|
Defina $F(m, n)$ como o número de tuplas $n$ de números inteiros positivos para os quais o produto dos elementos não excede $m$.
|
||||||
|
|
||||||
F(10, 10) = 571.
|
$F(10, 10) = 571$.
|
||||||
|
|
||||||
F(106, 106) mod 1 234 567 891 = 252903833.
|
$F({10}^6, {10}^6)\bmod 1.234.567.891 = 252.903.833$.
|
||||||
|
|
||||||
Find F(109, 109) mod 1 234 567 891.
|
Encontre $F({10}^9, {10}^9)\bmod 1.234.567.891$.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler452()` should return 345558983.
|
`longProducts()` deve retornar `345558983`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler452(), 345558983);
|
assert.strictEqual(longProducts(), 345558983);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -29,12 +29,12 @@ assert.strictEqual(euler452(), 345558983);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler452() {
|
function longProducts() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler452();
|
longProducts();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f5311000cf542c510044
|
id: 5900f5311000cf542c510044
|
||||||
title: 'Problem 453: Lattice Quadrilaterals'
|
title: 'Problema 453: Quadriláteros da rede'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302126
|
forumTopicId: 302126
|
||||||
dashedName: problem-453-lattice-quadrilaterals
|
dashedName: problem-453-lattice-quadrilaterals
|
||||||
@ -8,22 +8,24 @@ dashedName: problem-453-lattice-quadrilaterals
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
A simple quadrilateral is a polygon that has four distinct vertices, has no straight angles and does not self-intersect.
|
Um quadrilátero simples é um polígono que tem quatro vértices distintos, não tem ângulos retos e não cruza a si mesmo.
|
||||||
|
|
||||||
Let Q(m, n) be the number of simple quadrilaterals whose vertices are lattice points with coordinates (x,y) satisfying 0 ≤ x ≤ m and 0 ≤ y ≤ n.
|
Considere $Q(m, n)$ como o número de quadriláteros simples cujos vértices são pontos da rede com coordenadas ($x$, $y$) satisfazendo $0 ≤ x ≤ m$ e $0 ≤ y ≤ n$.
|
||||||
|
|
||||||
For example, Q(2, 2) = 94 as can be seen below:
|
Por exemplo, $Q(2, 2) = 94$ pode ser visto abaixo:
|
||||||
|
|
||||||
It can also be verified that Q(3, 7) = 39590, Q(12, 3) = 309000 and Q(123, 45) = 70542215894646.
|
<img class="img-responsive center-block" alt="94 quadriláteros cujos vértices são pontos da rede com coordenadas (x, y) satisfazendo 0 ≤ x ≤ m e 0 ≤ y ≤ n" src="https://cdn.freecodecamp.org/curriculum/project-euler/lattice-quadrilaterals.png" style="background-color: white; padding: 10px;" />
|
||||||
|
|
||||||
Find Q(12345, 6789) mod 135707531.
|
Também é possível verificar que $Q(3, 7) = 39.590$, $Q(12, 3) = 309.000$ e $Q(123, 45) = 70.542.215.894.646$.
|
||||||
|
|
||||||
|
Encontre $Q(12.345, 6.789)\bmod 135.707.531$.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler453()` should return 104354107.
|
`latticeQuadrilaterals()` deve retornar `104354107`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler453(), 104354107);
|
assert.strictEqual(latticeQuadrilaterals(), 104354107);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -31,12 +33,12 @@ assert.strictEqual(euler453(), 104354107);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler453() {
|
function latticeQuadrilaterals() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler453();
|
latticeQuadrilaterals();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f5331000cf542c510045
|
id: 5900f5331000cf542c510045
|
||||||
title: 'Problem 454: Diophantine reciprocals III'
|
title: 'Problema 454: Diofantinos recíprocos III'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302127
|
forumTopicId: 302127
|
||||||
dashedName: problem-454-diophantine-reciprocals-iii
|
dashedName: problem-454-diophantine-reciprocals-iii
|
||||||
@ -8,20 +8,22 @@ dashedName: problem-454-diophantine-reciprocals-iii
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
In the following equation x, y, and n are positive integers. 1/x + 1/y= 1/n
|
Na equação a seguir, $x$, $y$, e $n$ são números inteiros positivos.
|
||||||
|
|
||||||
<!-- TODO Use MathJax -->
|
$$\frac{1}{x} + \frac{1}{y} = \frac{1}{n}$$
|
||||||
|
|
||||||
For a limit L we define F(L) as the number of solutions which satisfy x < y ≤ L.
|
Para um limite $L$, definimos $F(L)$ como o número de soluções que satisfazem $x < y ≤ L$.
|
||||||
|
|
||||||
We can verify that F(15) = 4 and F(1000) = 1069. Find F(1012).
|
Podemos verificar que $F(15) = 4$ e $F(1000) = 1069$.
|
||||||
|
|
||||||
|
Encontre $F({10}^{12})$.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler454()` should return 5435004633092.
|
`diophantineReciprocalsThree()` deve retornar `5435004633092`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler454(), 5435004633092);
|
assert.strictEqual(diophantineReciprocalsThree(), 5435004633092);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -29,12 +31,12 @@ assert.strictEqual(euler454(), 5435004633092);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler454() {
|
function diophantineReciprocalsThree() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler454();
|
diophantineReciprocalsThree();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f5331000cf542c510046
|
id: 5900f5331000cf542c510046
|
||||||
title: 'Problem 455: Powers With Trailing Digits'
|
title: 'Problema 455: Potências com algarismos à direita'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302129
|
forumTopicId: 302129
|
||||||
dashedName: problem-455-powers-with-trailing-digits
|
dashedName: problem-455-powers-with-trailing-digits
|
||||||
@ -8,18 +8,20 @@ dashedName: problem-455-powers-with-trailing-digits
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Let f(n) be the largest positive integer x less than 109 such that the last 9 digits of nx form the number x (including leading zeros), or zero if no such integer exists.
|
Considere $f(n)$ como o maior número inteiro positivo $x$ inferior a ${10}^9$, tal que os últimos 9 algarismos de $n^x$ formam o número $x$ (incluindo zeros à esquerda) ou zero, se nenhum número inteiro desse tipo existir.
|
||||||
|
|
||||||
For example:
|
Por exemplo:
|
||||||
|
|
||||||
f(4) = 411728896 (4411728896 = ...490411728896) f(10) = 0 f(157) = 743757 (157743757 = ...567000743757) Σf(n), 2 ≤ n ≤ 103 = 442530011399 Find Σf(n), 2 ≤ n ≤ 106.
|
$$\begin{align} & f(4) = 411.728.896 (4^{411.728.896} = ...490\underline{411728896}) \\\\ & f(10) = 0 \\\\ & f(157) = 743.757 (157^{743.757} = ...567\underline{000743757}) \\\\ & Σf(n), 2 ≤ n ≤ 103 = 442.530.011.399 \end{align}$$
|
||||||
|
|
||||||
|
Encontre $\sum f(n)$, $2 ≤ n ≤ {10}^6$.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler455()` should return 450186511399999.
|
`powersWithTrailingDigits()` deve retornar `450186511399999`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler455(), 450186511399999);
|
assert.strictEqual(powersWithTrailingDigits(), 450186511399999);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -27,12 +29,12 @@ assert.strictEqual(euler455(), 450186511399999);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler455() {
|
function powersWithTrailingDigits() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler455();
|
powersWithTrailingDigits();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f5361000cf542c510049
|
id: 5900f5361000cf542c510049
|
||||||
title: 'Problem 458: Permutations of Project'
|
title: 'Problema 458: Permutações do projeto'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302132
|
forumTopicId: 302132
|
||||||
dashedName: problem-458-permutations-of-project
|
dashedName: problem-458-permutations-of-project
|
||||||
@ -8,20 +8,20 @@ dashedName: problem-458-permutations-of-project
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Consider the alphabet A made out of the letters of the word "project": A={c,e,j,o,p,r,t}.
|
Considere o alfabeto $A$ feito das letras da palavra `project`: $A = \\{c, e, j, o, p, r, t\\}$.
|
||||||
|
|
||||||
Let T(n) be the number of strings of length n consisting of letters from A that do not have a substring that is one of the 5040 permutations of "project".
|
Considere $T(n)$ como o número de strings de tamanho $n$ consistindo em letras de $A$ que não têm uma substring que seja uma das 5040 permutações de `project`.
|
||||||
|
|
||||||
T(7)=77-7!=818503.
|
$T(7) = 7^7 - 7! = 818.503$.
|
||||||
|
|
||||||
Find T(1012). Give the last 9 digits of your answer.
|
Encontre $T({10}^{12})$. Dê os últimos 9 algarismos da sua resposta.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler458()` should return 423341841.
|
`permutationsOfProject()` deve retornar `423341841`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler458(), 423341841);
|
assert.strictEqual(permutationsOfProject(), 423341841);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -29,12 +29,12 @@ assert.strictEqual(euler458(), 423341841);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler458() {
|
function permutationsOfProject() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler458();
|
permutationsOfProject();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f5371000cf542c51004a
|
id: 5900f5371000cf542c51004a
|
||||||
title: 'Problem 459: Flipping game'
|
title: 'Problema 459: Jogo de viradas'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302133
|
forumTopicId: 302133
|
||||||
dashedName: problem-459-flipping-game
|
dashedName: problem-459-flipping-game
|
||||||
@ -8,28 +8,38 @@ dashedName: problem-459-flipping-game
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
The flipping game is a two player game played on a N by N square board.
|
O jogo de viradas é um jogo de dois jogadores jogado em um tabuleiro quadrado de $N$ por $N$.
|
||||||
|
|
||||||
Each square contains a disk with one side white and one side black.
|
Cada quadrado contém um disco com um lado branco e um lado preto.
|
||||||
|
|
||||||
The game starts with all disks showing their white side.
|
O jogo termina quando todos os discos mostrarem seu lado branco.
|
||||||
|
|
||||||
A turn consists of flipping all disks in a rectangle with the following properties: the upper right corner of the rectangle contains a white disk the rectangle width is a perfect square (1, 4, 9, 16, ...) the rectangle height is a triangular number (1, 3, 6, 10, ...)
|
Um movimento consiste em virar todos os discos em um retângulo com as seguintes propriedades:
|
||||||
|
|
||||||
Players alternate turns. A player wins by turning the grid all black.
|
- o canto superior direito do retângulo consiste em um disco branco
|
||||||
|
- a largura do retângulo é um quadrado perfeito (1, 4, 9, 16, ...)
|
||||||
|
- a altura do retângulo é um número triangular (1, 3, 6, 10, ...)
|
||||||
|
|
||||||
Let W(N) be the number of winning moves for the first player on a N by N board with all disks white, assuming perfect play. W(1) = 1, W(2) = 0, W(5) = 8 and W(102) = 31395.
|
<img class="img-responsive center-block" alt="virando todos os discos em um retângulo de 4x3 em um tabuleiro de 5x5" src="https://cdn.freecodecamp.org/curriculum/project-euler/flipping-game-1.png" style="background-color: white; padding: 10px;" />
|
||||||
|
|
||||||
For N=5, the first player's eight winning first moves are:
|
Os jogadores alternam a vez. Um jogador ganha ao tornar a grade toda preta.
|
||||||
|
|
||||||
Find W(106).
|
Considere $W(N)$ como o número de movimentos vencedores para o primeiro jogador em um tabuleiro $N$ por $N$ com todos os discos brancos, assumindo uma jogada perfeita.
|
||||||
|
|
||||||
|
$W(1) = 1$, $W(2) = 0$, $W(5) = 8$ e $W({10}^2) = 31.395$.
|
||||||
|
|
||||||
|
Para $N = 5$, os oito primeiros movimentos vencedores do primeiro jogador são:
|
||||||
|
|
||||||
|
<img class="img-responsive center-block" alt="oito primeiros movimentos vencedores para N = 5" src="https://cdn.freecodecamp.org/curriculum/project-euler/flipping-game-2.png" style="background-color: white; padding: 10px;" />
|
||||||
|
|
||||||
|
Encontre $W({10}^6)$.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler459()` should return 3996390106631.
|
`flippingGame()` deve retornar `3996390106631`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler459(), 3996390106631);
|
assert.strictEqual(flippingGame(), 3996390106631);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -37,12 +47,12 @@ assert.strictEqual(euler459(), 3996390106631);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler459() {
|
function flippingGame() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler459();
|
flippingGame();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f5381000cf542c51004b
|
id: 5900f5381000cf542c51004b
|
||||||
title: 'Problem 460: An ant on the move'
|
title: 'Problema 460: Uma formiga em movimento'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302135
|
forumTopicId: 302135
|
||||||
dashedName: problem-460-an-ant-on-the-move
|
dashedName: problem-460-an-ant-on-the-move
|
||||||
@ -8,24 +8,33 @@ dashedName: problem-460-an-ant-on-the-move
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
On the Euclidean plane, an ant travels from point A(0, 1) to point B(d, 1) for an integer d.
|
No plano euclideano, uma formiga viaja do ponto $A(0, 1)$ ao ponto $B(d, 1)$ para um número inteiro $d$.
|
||||||
|
|
||||||
In each step, the ant at point (x0, y0) chooses one of the lattice points (x1, y1) which satisfy x1 ≥ 0 and y1 ≥ 1 and goes straight to (x1, y1) at a constant velocity v. The value of v depends on y0 and y1 as follows: If y0 = y1, the value of v equals y0. If y0 ≠ y1, the value of v equals (y1 - y0) / (ln(y1) - ln(y0)).
|
Em cada passo, a formiga no ponto ($x_0$, $y_0$) escolhe um dos pontos da rede ($x_1$, $y_1$) que satisfaça $x_1 ≥ 0$ e $y_1 ≥ 1$ e vai direto para ($x_1$, $y_1$) com velocidade vetorial constante $v$. O valor de $v$ depende de $y_0$ e $y_1$ da seguinte forma:
|
||||||
|
|
||||||
The left image is one of the possible paths for d = 4. First the ant goes from A(0, 1) to P1(1, 3) at velocity (3 - 1) / (ln(3) - ln(1)) ≈ 1.8205. Then the required time is sqrt(5) / 1.8205 ≈ 1.2283. From P1(1, 3) to P2(3, 3) the ant travels at velocity 3 so the required time is 2 / 3 ≈ 0.6667. From P2(3, 3) to B(4, 1) the ant travels at velocity (1 - 3) / (ln(1) - ln(3)) ≈ 1.8205 so the required time is sqrt(5) / 1.8205 ≈ 1.2283. Thus the total required time is 1.2283 + 0.6667 + 1.2283 = 3.1233.
|
- Se $y_0 = y_1$, o valor de $v$ é igual a $y_0$.
|
||||||
|
- Se $y_0 ≠ y_1$, o valor de $v$ é igual a $\frac{y_1 - y_0}{\ln y_1 - \ln y_0}$.
|
||||||
|
|
||||||
The right image is another path. The total required time is calculated as 0.98026 + 1 + 0.98026 = 2.96052. It can be shown that this is the quickest path for d = 4.
|
A imagem á esquerda é um dos possíveis caminhos para $d = 4$. Primeiro, a formiga vai de $A(0, 1)$ para $P_1(1, 3)$ a uma velocidade de $\frac{3 - 1}{\ln 3 - \ln 1} ≈ 1.8205$. Então, o tempo necessário é de $\frac{\sqrt{5}}{1.820} ≈ 1.2283$.
|
||||||
|
|
||||||
Let F(d) be the total required time if the ant chooses the quickest path. For example, F(4) ≈ 2.960516287. We can verify that F(10) ≈ 4.668187834 and F(100) ≈ 9.217221972.
|
De $P_1(1, 3)$ para $P_2(3, 3)$, a formiga viaja à uma velocidade vetorial de 3. Então, o tempo necessário é $\frac{2}{3} ≈ 0.6667$. De $P_2(3, 3)$ para $B(4, 1)$, a formiga viaja à uma velocidade vetorial de $\frac{1 - 3}{\ln 1 - \ln 3} ≈ 1.8205$. Então, o tempo necessário será $\frac{\sqrt{5}}{1.8205} ≈ 1.2283$.
|
||||||
|
|
||||||
Find F(10000). Give your answer rounded to nine decimal places.
|
Dessa forma, o tempo total necessário é de $1.2283 + 0.6667 + 1.2283 = 3.1233$.
|
||||||
|
|
||||||
|
A imagem à direita é outro caminho. O tempo total necessário é calculado por $0.98026 + 1 + 0.98026 = 2.96052$. Isso mostra que esse é o caminho mais rápido para $d = 4$.
|
||||||
|
|
||||||
|
<img class="img-responsive center-block" alt="dois caminhos possíveis para d = 4" src="https://cdn.freecodecamp.org/curriculum/project-euler/an-ant-on-the-move.jpg" style="background-color: white; padding: 10px;" />
|
||||||
|
|
||||||
|
Considere $F(d)$ como o tempo total necessário se a formiga escolher o caminho mais rápido. Por exemplo, $F(4) ≈ 2.960.516.287$. Podemos verificar que $F(10) ≈ 4.668.187.834$ e que $F(100) ≈ 9.217.221.972$.
|
||||||
|
|
||||||
|
Calcule $F(10.000)$. Dê sua resposta arredondada para nove casas decimais.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler460()` should return 18.420738199.
|
`antOnTheMove()` deve retornar `18.420738199`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler460(), 18.420738199);
|
assert.strictEqual(antOnTheMove(), 18.420738199);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -33,12 +42,12 @@ assert.strictEqual(euler460(), 18.420738199);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler460() {
|
function antOnTheMove() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler460();
|
antOnTheMove();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f53a1000cf542c51004c
|
id: 5900f53a1000cf542c51004c
|
||||||
title: 'Problem 461: Almost Pi'
|
title: 'Problema 461: Quase pi'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302136
|
forumTopicId: 302136
|
||||||
dashedName: problem-461-almost-pi
|
dashedName: problem-461-almost-pi
|
||||||
@ -8,43 +8,43 @@ dashedName: problem-461-almost-pi
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Let `f(k, n)` = $e^\frac{k}{n} - 1$, for all non-negative integers `k`.
|
Considere `f(k, n)` = $e^\frac{k}{n} - 1$, para todos os números inteiros não negativos `k`.
|
||||||
|
|
||||||
Remarkably, `f(6, 200) + f(75, 200) + f(89, 200) + f(226, 200)` = 3.1415926… ≈ π.
|
Notadamente, `f(6, 200) + f(75, 200) + f(89, 200) + f(226, 200)` = 3.1415926… ≈ π.
|
||||||
|
|
||||||
In fact, it is the best approximation of π of the form `f(a, 200) + f(b, 200) + f(c, 200) + f(d, 200)`.
|
De fato, essa é a melhor aproximação de π da forma `f(a, 200) + f(b, 200) + f(c, 200) + f(d, 200)`.
|
||||||
|
|
||||||
Let `almostPi(n)` = a<sup>2</sup> + b<sup>2</sup> + c<sup>2</sup> + d<sup>2</sup> for a, b, c, d that minimize the error: $\lvert f(a,n) + f(b,n) + f(c,n) + f(d,n) - \Pi\rvert$
|
Considere `almostPi(n)` = a<sup>2</sup> + b<sup>2</sup> + c<sup>2</sup> + d<sup>2</sup> para a, b, c, d que minimiza o erro: $\lvert f(a,n) + f(b,n) + f(c,n) + f(d,n) - \Pi\rvert$
|
||||||
|
|
||||||
You are given `almostPi(200)` = 6<sup>2</sup> + 75<sup>2</sup> + 89<sup>2</sup> + 226<sup>2</sup> = 64658.
|
Você é informado de que `almostPi(200)` = 6<sup>2</sup> + 75<sup>2</sup> + 89<sup>2</sup> + 226<sup>2</sup> = 64658.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`almostPi` should be a function.
|
`almostPi` deve ser uma função.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert(typeof almostPi === 'function')
|
assert(typeof almostPi === 'function')
|
||||||
```
|
```
|
||||||
|
|
||||||
`almostPi` should return a number.
|
`almostPi` deve retornar um número.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(typeof almostPi(10), 'number');
|
assert.strictEqual(typeof almostPi(10), 'number');
|
||||||
```
|
```
|
||||||
|
|
||||||
`almostPi(29)` should return `1208`.
|
`almostPi(29)` deve retornar `1208`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(almostPi(29), 1208);
|
assert.strictEqual(almostPi(29), 1208);
|
||||||
```
|
```
|
||||||
|
|
||||||
`almostPi(50)` should return `4152`.
|
`almostPi(50)` deve retornar `4152`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(almostPi(50), 4152);
|
assert.strictEqual(almostPi(50), 4152);
|
||||||
```
|
```
|
||||||
|
|
||||||
`almostPi(200)` should return `64658`.
|
`almostPi(200)` deve retornar `64658`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(almostPi(200), 64658);
|
assert.strictEqual(almostPi(200), 64658);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f53b1000cf542c51004d
|
id: 5900f53b1000cf542c51004d
|
||||||
title: 'Problem 462: Permutation of 3-smooth numbers'
|
title: 'Problema 462: Permutação de números três harmoniosos'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302137
|
forumTopicId: 302137
|
||||||
dashedName: problem-462-permutation-of-3-smooth-numbers
|
dashedName: problem-462-permutation-of-3-smooth-numbers
|
||||||
@ -8,28 +8,34 @@ dashedName: problem-462-permutation-of-3-smooth-numbers
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
<!-- TODO use MathJax -->
|
Um número 3 harmonioso é um número inteiro que não tem fatores primos maiores que 3. Para um número inteiro $N$, definimos $S(N)$ como o conjunto de números 3 harmoniosos menores ou iguais a $N$. Por exemplo, $S(20) = \\{1, 2, 3, 4, 6, 8, 9, 12, 16, 18\\}$.
|
||||||
|
|
||||||
A 3-smooth number is an integer which has no prime factor larger than 3. For an integer N, we define S(N) as the set of 3-smooth numbers less than or equal to N . For example, S(20) = { 1, 2, 3, 4, 6, 8, 9, 12, 16, 18 }.
|
Definimos $F(N)$ como o número de permutações de $S(N)$ em que cada elemento vem depois de todos os seus divisores apropriados.
|
||||||
|
|
||||||
We define F(N) as the number of permutations of S(N) in which each element comes after all of its proper divisors.
|
Esta é uma das permutações possíveis para $N = 20$.
|
||||||
|
|
||||||
This is one of the possible permutations for N = 20.
|
|
||||||
|
|
||||||
- 1, 2, 4, 3, 9, 8, 16, 6, 18, 12.
|
- 1, 2, 4, 3, 9, 8, 16, 6, 18, 12.
|
||||||
|
|
||||||
This is not a valid permutation because 12 comes before its divisor 6.
|
Esta não é uma permutação válida porque 12 vem antes do seu divisor 6.
|
||||||
|
|
||||||
- 1, 2, 4, 3, 9, 8, 12, 16, 6, 18.
|
- 1, 2, 4, 3, 9, 8, 12, 16, 6, 18.
|
||||||
|
|
||||||
We can verify that F(6) = 5, F(8) = 9, F(20) = 450 and F(1000) ≈ 8.8521816557e21. Find F(1018). Give as your answer its scientific notation rounded to ten digits after the decimal point. When giving your answer, use a lowercase e to separate mantissa and exponent. E.g. if the answer is 112,233,445,566,778,899 then the answer format would be 1.1223344557e17.
|
Podemos verificar que $F(6) = 5$, $F(8) = 9$, $F(20) = 450$ e $F(1000) ≈ 8.8521816557e.21$.
|
||||||
|
|
||||||
|
Encontre $F({10}^{18})$. Dê sua resposta como uma string em notação científica arredondada para dez algarismos depois da vírgula. Ao dar sua resposta, use letra minúscula `e` para separar a mantissa e o expoente. Ex: se a resposta é $112.233.445.566.778.899$, o formato da resposta seria `1.1223344557e17`.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler462()` should return Infinity.
|
`permutationOf3SmoothNumbers()` deve retornar uma string.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler462(), Infinity);
|
assert.strictEqual(typeof permutationOf3SmoothNumbers() === 'string');
|
||||||
|
```
|
||||||
|
|
||||||
|
`permutationOf3SmoothNumbers()` deve retornar a string `5.5350769703e1512`.
|
||||||
|
|
||||||
|
```js
|
||||||
|
assert.strictEqual(permutationOf3SmoothNumbers(), '5.5350769703e1512');
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -37,12 +43,12 @@ assert.strictEqual(euler462(), Infinity);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler462() {
|
function permutationOf3SmoothNumbers() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler462();
|
permutationOf3SmoothNumbers();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f53c1000cf542c51004e
|
id: 5900f53c1000cf542c51004e
|
||||||
title: 'Problem 463: A weird recurrence relation'
|
title: 'Problema 463: Uma relação de recorrência estranha'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302138
|
forumTopicId: 302138
|
||||||
dashedName: problem-463-a-weird-recurrence-relation
|
dashedName: problem-463-a-weird-recurrence-relation
|
||||||
@ -8,26 +8,22 @@ dashedName: problem-463-a-weird-recurrence-relation
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
The function $f$ is defined for all positive integers as follows:
|
A função $f$ é definida para todos os números inteiros positivos da seguinte forma:
|
||||||
|
|
||||||
$f(1)=1$
|
$$\begin{align} & f(1) = 1 \\\\ & f(3) = 3 \\\\ & f(2n) = f(n) \\\\ & f(4n + 1) = 2f(2n + 1) - f(n) \\\\ & f(4n + 3) = 3f(2n + 1) - 2f(n) \end{align}$$
|
||||||
|
|
||||||
$f(3)=3$
|
A função $S(n)$ é definida como $\sum_{i=1}^{n} f(i)$.
|
||||||
|
|
||||||
$f(2n)=f(n)$
|
$S(8) = 22$ e $S(100) = 3604$.
|
||||||
|
|
||||||
$f(4n + 1)=2f(2n + 1) - f(n)$
|
Encontre $S(3^{37})$. Dê os últimos 9 algarismos da sua resposta.
|
||||||
|
|
||||||
$f(4n + 3)=3f(2n + 1) - 2f(n)$
|
|
||||||
|
|
||||||
The function $S(n)$ is defined as $\\sum\_{i=1}^{n}f(i)$. $S(8)=22$ and $S(100)=3604$. Find $S(3^{37})$. Give the last 9 digits of your answer.
|
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler463()` should return 808981553.
|
`weirdRecurrenceRelation()` deve retornar `808981553`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler463(), 808981553);
|
assert.strictEqual(weirdRecurrenceRelation(), 808981553);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -35,12 +31,12 @@ assert.strictEqual(euler463(), 808981553);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler463() {
|
function weirdRecurrenceRelation() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler463();
|
weirdRecurrenceRelation();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f53d1000cf542c51004f
|
id: 5900f53d1000cf542c51004f
|
||||||
title: 'Problem 464: Möbius function and intervals'
|
title: 'Problema 464: Função de Möbius e intervalos'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302139
|
forumTopicId: 302139
|
||||||
dashedName: problem-464-mbius-function-and-intervals
|
dashedName: problem-464-mbius-function-and-intervals
|
||||||
@ -8,26 +8,33 @@ dashedName: problem-464-mbius-function-and-intervals
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
The Möbius function, denoted μ(n), is defined as:
|
A função de Möbius, denotada por $μ(n)$, é definida como:
|
||||||
|
|
||||||
μ(n) = (-1)ω(n) if n is squarefree (where ω(n) is the number of distinct prime factors of n)
|
- $μ(n) = (-1)^{ω(n)}$ se $n$ não tiver quadrados (onde $ω(n)$ é o número de fatores primos distintos de $n$)
|
||||||
|
- $μ(n) = 0$ se $n$ não for sem quadrados.
|
||||||
|
|
||||||
μ(n) = 0 if n is not squarefree.
|
Considere $P(a, b)$ como a quantidade de números inteiros $n$ no intervalo $[a, b]$, tal que $μ(n) = 1$.
|
||||||
|
|
||||||
Let P(a,b) be the number of integers n in the interval \[a,b] such that μ(n) = 1. Let N(a,b) be the number of integers n in the interval \[a,b] such that μ(n) = -1. For example, P(2,10) = 2 and N(2,10) = 4.
|
Considere $N(a, b)$ como a quantidade de números inteiros $n$ no intervalo $[a, b]$, tal que $μ(n) = -1$.
|
||||||
|
|
||||||
Let C(n) be the number of integer pairs (a,b) such that: 1 ≤ a ≤ b ≤ n, 99·N(a,b) ≤ 100·P(a,b), and 99·P(a,b) ≤ 100·N(a,b).
|
Por exemplo, $P(2, 10) = 2$ e $N(2, 10) = 4$.
|
||||||
|
|
||||||
For example, C(10) = 13, C(500) = 16676 and C(10 000) = 20155319.
|
Considere $C(n)$ como a quantidade de pares de números inteiros $(a, b)$, tal que:
|
||||||
|
|
||||||
Find C(20 000 000).
|
- $1 ≤ a ≤ b ≤ n$,
|
||||||
|
- $99 \times N(a, b) ≤ 100 \times P(a, b)$, e
|
||||||
|
- $99 \times P(a, b) ≤ 100 \times N(a, b)$.
|
||||||
|
|
||||||
|
Por exemplo, $C(10) = 13$, $C(500) = 16.676$ e $C(10.000) = 20.155.319$.
|
||||||
|
|
||||||
|
Encontre $C(20.000.000)$.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler464()` should return 198775297232878.
|
`mobiusFunctionAndIntervals()` deve retornar `198775297232878`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler464(), 198775297232878);
|
assert.strictEqual(mobiusFunctionAndIntervals(), 198775297232878);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -35,12 +42,12 @@ assert.strictEqual(euler464(), 198775297232878);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler464() {
|
function mobiusFunctionAndIntervals() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler464();
|
mobiusFunctionAndIntervals();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f53d1000cf542c510050
|
id: 5900f53d1000cf542c510050
|
||||||
title: 'Problem 465: Polar polygons'
|
title: 'Problema 465: Polígonos polares'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302140
|
forumTopicId: 302140
|
||||||
dashedName: problem-465-polar-polygons
|
dashedName: problem-465-polar-polygons
|
||||||
@ -8,28 +8,30 @@ dashedName: problem-465-polar-polygons
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
The kernel of a polygon is defined by the set of points from which the entire polygon's boundary is visible. We define a polar polygon as a polygon for which the origin is strictly contained inside its kernel.
|
O núcleo de um polígono é definido pelo conjunto de pontos a partir dos quais todo o limite do polígono é visível. Definimos um polígono polar como um polígono para o qual a origem está estritamente contida no seu núcleo.
|
||||||
|
|
||||||
For this problem, a polygon can have collinear consecutive vertices. However, a polygon still cannot have self-intersection and cannot have zero area.
|
Para este problema, um polígono pode ter vértices consecutivos colineares. No entanto, um polígono ainda não pode ter autointerseções e não pode ter uma área igual a zero.
|
||||||
|
|
||||||
For example, only the first of the following is a polar polygon (the kernels of the second, third, and fourth do not strictly contain the origin, and the fifth does not have a kernel at all):
|
Por exemplo, apenas o primeiro dos polígonos a seguir é um polígono polar (os núcleos do segundo, terceiro, e quarto não contêm estritamente a origem e o quinto nem sequer tem um núcleo):
|
||||||
|
|
||||||
Notice that the first polygon has three consecutive collinear vertices.
|
<img class="img-responsive center-block" alt="cinco exemplos de polígonos" src="https://cdn.freecodecamp.org/curriculum/project-euler/polar-polygons.png" style="background-color: white; padding: 10px;" />
|
||||||
|
|
||||||
Let P(n) be the number of polar polygons such that the vertices (x, y) have integer coordinates whose absolute values are not greater than n.
|
Observe que o primeiro polígono tem três vértices colineares consecutivos.
|
||||||
|
|
||||||
Note that polygons should be counted as different if they have different set of edges, even if they enclose the same area. For example, the polygon with vertices \[(0,0),(0,3),(1,1),(3,0)] is distinct from the polygon with vertices \[(0,0),(0,3),(1,1),(3,0),(1,0)].
|
Considere $P(n)$ como o número de polígonos polares, tal que os vértices $(x, y)$ têm coordenadas em números inteiros, cujos valores absolutos não são maiores do que $n$.
|
||||||
|
|
||||||
For example, P(1) = 131, P(2) = 1648531, P(3) = 1099461296175 and P(343) mod 1 000 000 007 = 937293740.
|
Observe que os polígonos devem ser contados como diferentes se tiverem um grupo de arestas diferentes, mesmo que envolvam a mesma área. Por exemplo, o polígono com vértices [(0,0), (0,3), (1,1), (3,0)] é diferente do polígono com vértices [(0,0), (0,3), (1,1), (3,0), (1,0)].
|
||||||
|
|
||||||
Find P(713) mod 1 000 000 007.
|
Por exemplo, $P(1) = 131$, $P(2) = 1.648.531$, $P(3) = 1.099.461.296.175$ e $P(343)\bmod 1.000.000.007 = 937.293.740$.
|
||||||
|
|
||||||
|
Encontre $P(7^{13})\bmod 1.000.000.007$.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler465()` should return 585965659.
|
`polarPolygons()` deve retornar `585965659`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler465(), 585965659);
|
assert.strictEqual(polarPolygons(), 585965659);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -37,12 +39,12 @@ assert.strictEqual(euler465(), 585965659);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler465() {
|
function polarPolygons() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler465();
|
polarPolygons();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f53e1000cf542c510051
|
id: 5900f53e1000cf542c510051
|
||||||
title: 'Problem 466: Distinct terms in a multiplication table'
|
title: 'Problema 466: Termos distintos em uma tabela de multiplicação'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302141
|
forumTopicId: 302141
|
||||||
dashedName: problem-466-distinct-terms-in-a-multiplication-table
|
dashedName: problem-466-distinct-terms-in-a-multiplication-table
|
||||||
@ -8,24 +8,26 @@ dashedName: problem-466-distinct-terms-in-a-multiplication-table
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Let P(m,n) be the number of distinct terms in an m×n multiplication table.
|
Considere $P(m,n)$ como o número de termos distintos em uma tabela de multiplicação de $m×n$.
|
||||||
|
|
||||||
For example, a 3×4 multiplication table looks like this:
|
Por exemplo, uma tabela de multiplicação 3×4 fica assim:
|
||||||
|
|
||||||
× 12341 12342 24683 36912
|
$$\begin{array}{c} × & \mathbf{1} & \mathbf{2} & \mathbf{3} & \mathbf{4} \\\\ \mathbf{1} & 1 & 2 & 3 & 4 \\\\ \mathbf{2} & 2 & 4 & 6 & 8 \\\\ \mathbf{3} & 3 & 6 & 9 & 12 \end{array}$$
|
||||||
|
|
||||||
There are 8 distinct terms {1,2,3,4,6,8,9,12}, therefore P(3,4) = 8.
|
Existem 8 termos distintos {1, 2, 3, 4, 6, 8, 9, 12}, portanto $P(3, 4) = 8$.
|
||||||
|
|
||||||
You are given that: P(64,64) = 1263, P(12,345) = 1998, and P(32,1015) = 13826382602124302.
|
Você é informado de que:
|
||||||
|
|
||||||
Find P(64,1016).
|
$$\begin{align} & P(64, 64) = 1.263, \\\\ & P(12, 345) = 1.998, \text{ e} \\\\ & P(32, {10}^{15}) = 13.826.382.602.124.302. \\\\ \end{align}$$
|
||||||
|
|
||||||
|
Encontre $P(64, {10}^{16})$.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler466()` should return 258381958195474750.
|
`multiplicationTable()` deve retornar `258381958195474750`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler466(), 258381958195474750);
|
assert.strictEqual(multiplicationTable(), 258381958195474750);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -33,12 +35,12 @@ assert.strictEqual(euler466(), 258381958195474750);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler466() {
|
function multiplicationTable() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler466();
|
multiplicationTable();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f5411000cf542c510052
|
id: 5900f5411000cf542c510052
|
||||||
title: 'Problem 467: Superinteger'
|
title: 'Problema 467: Superinteiro'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302142
|
forumTopicId: 302142
|
||||||
dashedName: problem-467-superinteger
|
dashedName: problem-467-superinteger
|
||||||
@ -8,26 +8,32 @@ dashedName: problem-467-superinteger
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
An integer s is called a superinteger of another integer n if the digits of n form a subsequence of the digits of s.
|
Um inteiro $s$ é chamado de superinteiro de outro inteiro $n$ se os algarismos de $n$ formarem uma subsequência dos algarismos de $s$.
|
||||||
|
|
||||||
For example, 2718281828 is a superinteger of 18828, while 314159 is not a superinteger of 151.
|
Por exemplo, 2718281828 é um superinteiro de 18828, enquanto 314159 não é um superinteiro de 151.
|
||||||
|
|
||||||
Let p(n) be the nth prime number, and let c(n) be the nth composite number. For example, p(1) = 2, p(10) = 29, c(1) = 4 and c(10) = 18. {p(i) : i ≥ 1} = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, ...} {c(i) : i ≥ 1} = {4, 6, 8, 9, 10, 12, 14, 15, 16, 18, ...}
|
Considere $p(n)$ como o número primo $n$ e $c(n)$ como o $n$º número composto. Por exemplo, $p(1) = 2$, $p(10) = 29$, $c(1) = 4$ e $c(10) = 18$.
|
||||||
|
|
||||||
Let PD the sequence of the digital roots of {p(i)} (CD is defined similarly for {c(i)}): PD = {2, 3, 5, 7, 2, 4, 8, 1, 5, 2, ...} CD = {4, 6, 8, 9, 1, 3, 5, 6, 7, 9, ...}
|
$$\begin{align} & \\{p(i) : i ≥ 1\\} = \\{2, 3, 5, 7, 11, 13, 17, 19, 23, 29, \ldots \\} \\\\ & \\{c(i) : i ≥ 1\\} = \\{4, 6, 8, 9, 10, 12, 14, 15, 16, 18, \ldots \\} \end{align}$$
|
||||||
|
|
||||||
Let Pn be the integer formed by concatenating the first n elements of PD (Cn is defined similarly for CD). P10 = 2357248152 C10 = 4689135679
|
Considere $P^D$ como a sequência de raízes dos algarismos de $\\{p(i)\\}$ ($C^D$ é definido da mesma forma para $\\{c(i)\\}$):
|
||||||
|
|
||||||
Let f(n) be the smallest positive integer that is a common superinteger of Pn and Cn. For example, f(10) = 2357246891352679, and f(100) mod 1 000 000 007 = 771661825.
|
$$\begin{align} & P^D = \\{2, 3, 5, 7, 2, 4, 8, 1, 5, 2, \ldots \\} \\\\ & C^D = \\{4, 6, 8, 9, 1, 3, 5, 6, 7, 9, \ldots \\} \end{align}$$
|
||||||
|
|
||||||
Find f(10 000) mod 1 000 000 007.
|
Considere $P_n$ como o número inteiro formado concatenando os primeiros $n$ elementos de $P^D$ ($C_n$ é definido de forma semelhante para $C^D$).
|
||||||
|
|
||||||
|
$$\begin{align} & P_{10} = 2.357.248.152 \\\\ & C_{10} = 4.689.135.679 \end{align}$$
|
||||||
|
|
||||||
|
Considere $f(n)$ como o menor número inteiro positivo que seja um superinteiro comum de $P_n$ e $C_n$. Por exemplo, $f(10) = 2.357.246.891.352.679$ e $f(100)\bmod 1.000.000.007 = 771.661.825$.
|
||||||
|
|
||||||
|
Encontre $f(10.000)\bmod 1.000.000.007$.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler467()` should return 775181359.
|
`superinteger()` deve retornar `775181359`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler467(), 775181359);
|
assert.strictEqual(superinteger(), 775181359);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -35,12 +41,12 @@ assert.strictEqual(euler467(), 775181359);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler467() {
|
function superinteger() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler467();
|
superinteger();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f5411000cf542c510054
|
id: 5900f5411000cf542c510054
|
||||||
title: 'Problem 468: Smooth divisors of binomial coefficients'
|
title: 'Problema 468: Divisores harmonizados de coeficientes binomiais'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302143
|
forumTopicId: 302143
|
||||||
dashedName: problem-468-smooth-divisors-of-binomial-coefficients
|
dashedName: problem-468-smooth-divisors-of-binomial-coefficients
|
||||||
@ -8,20 +8,28 @@ dashedName: problem-468-smooth-divisors-of-binomial-coefficients
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
An integer is called B-smooth if none of its prime factors is greater than B.
|
Um inteiro é chamado de harmonizado de B se nenhum de seus fatores primos é maior que $B$.
|
||||||
|
|
||||||
Let SB(n) be the largest B-smooth divisor of n. Examples: S1(10) = 1 S4(2100) = 12 S17(2496144) = 5712
|
Considere $SB(n)$ como o maior divisor harmonizado de B de $n$.
|
||||||
|
|
||||||
Define F(n) = ∑1≤B≤n ∑0≤r≤n SB(C(n,r)). Here, C(n,r) denotes the binomial coefficient. Examples: F(11) = 3132 F(1 111) mod 1 000 000 993 = 706036312 F(111 111) mod 1 000 000 993 = 22156169
|
Exemplos:
|
||||||
|
|
||||||
Find F(11 111 111) mod 1 000 000 993.
|
$$\begin{align} & S_1(10) = 1 \\\\ & S_4(2.100) = 12 \\\\ & S_{17}(2.496.144) = 5.712 \end{align}$$
|
||||||
|
|
||||||
|
Defina $F(n) = \displaystyle\sum_{B = 1}^n \sum_{r = 0}^n S_B(\displaystyle\binom{n}{r})$. Aqui, $\displaystyle\binom{n}{r}$ denota o coeficiente binomial.
|
||||||
|
|
||||||
|
Exemplos:
|
||||||
|
|
||||||
|
$$\begin{align} & F(11) = 3132 \\\\ & F(1.111)\bmod 1.000.000.993 = 706.036.312 \\\\ & F(111.111)\bmod 1.000.000.993 = 22.156.169 \end{align}$$
|
||||||
|
|
||||||
|
Encontre $F(11.111.111)\bmod 1.000.000.993$.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler468()` should return 852950321.
|
`smoothDivisorsOfBinomialCoefficients()` deve retornar `852950321`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler468(), 852950321);
|
assert.strictEqual(smoothDivisorsOfBinomialCoefficients(), 852950321);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -29,12 +37,12 @@ assert.strictEqual(euler468(), 852950321);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler468() {
|
function smoothDivisorsOfBinomialCoefficients() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler468();
|
smoothDivisorsOfBinomialCoefficients();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f5411000cf542c510053
|
id: 5900f5411000cf542c510053
|
||||||
title: 'Problem 469: Empty chairs'
|
title: 'Problema 469: Cadeiras vazias'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302144
|
forumTopicId: 302144
|
||||||
dashedName: problem-469-empty-chairs
|
dashedName: problem-469-empty-chairs
|
||||||
@ -8,22 +8,24 @@ dashedName: problem-469-empty-chairs
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
In a room N chairs are placed around a round table.
|
Em uma sala, $N$ cadeiras são colocadas ao redor de uma mesa redonda.
|
||||||
|
|
||||||
Knights enter the room one by one and choose at random an available empty chair.
|
Cavaleiros entram na sala um por um e escolhem aleatoriamente uma cadeira vazia disponível.
|
||||||
|
|
||||||
To have enough elbow room the knights always leave at least one empty chair between each other.
|
Para ter espaço suficiente, os cavaleiros sempre deixam pelo menos uma cadeira vazia entre eles.
|
||||||
|
|
||||||
When there aren't any suitable chairs left, the fraction C of empty chairs is determined. We also define E(N) as the expected value of C. We can verify that E(4) = 1/2 and E(6) = 5/9.
|
Quando não sobrar nenhuma cadeira apropriada, a fração $C$ de cadeiras vazias é determinada. Também definimos $E(N)$ como o valor esperado de $C$.
|
||||||
|
|
||||||
Find E(1018). Give your answer rounded to fourteen decimal places in the form 0.abcdefghijklmn.
|
Podemos verificar que $E(4) = \frac{1}{2}$ e $E(6) = \frac{5}{9}$.
|
||||||
|
|
||||||
|
Encontre $E({10}^{18})$. Arredonde sua resposta para até catorze casas decimais usando o formato 0.abcdefghijklmn.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler469()` should return 0.56766764161831.
|
`emptyChairs()` deve retornar `0.56766764161831`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler469(), 0.56766764161831);
|
assert.strictEqual(emptyChairs(), 0.56766764161831);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -31,12 +33,12 @@ assert.strictEqual(euler469(), 0.56766764161831);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler469() {
|
function emptyChairs() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler469();
|
emptyChairs();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f5431000cf542c510055
|
id: 5900f5431000cf542c510055
|
||||||
title: 'Problem 470: Super Ramvok'
|
title: 'Problema 470: Super Ramvok'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302146
|
forumTopicId: 302146
|
||||||
dashedName: problem-470-super-ramvok
|
dashedName: problem-470-super-ramvok
|
||||||
@ -8,26 +8,26 @@ dashedName: problem-470-super-ramvok
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Consider a single game of Ramvok:
|
Considere um único jogo de Ramvok:
|
||||||
|
|
||||||
Let t represent the maximum number of turns the game lasts. If t = 0, then the game ends immediately. Otherwise, on each turn i, the player rolls a die. After rolling, if i < t the player can either stop the game and receive a prize equal to the value of the current roll, or discard the roll and try again next turn. If i = t, then the roll cannot be discarded and the prize must be accepted. Before the game begins, t is chosen by the player, who must then pay an up-front cost ct for some constant c. For c = 0, t can be chosen to be infinite (with an up-front cost of 0). Let R(d, c) be the expected profit (i.e. net gain) that the player receives from a single game of optimally-played Ramvok, given a fair d-sided die and cost constant c. For example, R(4, 0.2) = 2.65. Assume that the player has sufficient funds for paying any/all up-front costs.
|
$t$ representa o número máximo de turnos que o jogo dura. Se $t = 0$, então o jogo termina imediatamente. Caso contrário, em cada turno $i$, o jogador rola um dado. Depois de rolar, se $i < t$, o jogador pode parar o jogo e receber um prêmio igual ao valor da rolada de dados atual, ou descartar a rolada e tentar novamente no próximo turno. Se $i = t$, a rolada não pode ser descartada e o prêmio deve ser aceito. Antes de o jogo começar, $t$ é escolhido pelo jogador, que deve pagar um custo inicial $ct$ para algum $c$ constante. Para $c = 0$, $t$ pode ser escolhido como infinito (com um custo adiantado de 0). Considere $R(d, c)$ como o lucro esperado (ou seja, ganho líquido) que o jogador recebe de uma única partida de Ramvok jogado de maneira ideal, dado que o dado de $d$ lados é justo e com custo constante de $c$. Por exemplo, $R(4, 0,2) = 2,65$. Suponha que o jogador tem fundos suficientes para pagar todo e qualquer custo inicial.
|
||||||
|
|
||||||
Now consider a game of Super Ramvok:
|
Agora considere um jogo de Super Ramvok:
|
||||||
|
|
||||||
In Super Ramvok, the game of Ramvok is played repeatedly, but with a slight modification. After each game, the die is altered. The alteration process is as follows: The die is rolled once, and if the resulting face has its pips visible, then that face is altered to be blank instead. If the face is already blank, then it is changed back to its original value. After the alteration is made, another game of Ramvok can begin (and during such a game, at each turn, the die is rolled until a face with a value on it appears). The player knows which faces are blank and which are not at all times. The game of Super Ramvok ends once all faces of the die are blank.
|
No Super Ramvok, o jogo de Ramvok é jogado repetidamente, mas com uma pequena modificação. Após cada jogo, o dado é alterado. O processo de alteração é o seguinte: o dado é rolado uma vez, e se a face resultante tem seus pontos visíveis, então essa face é alterada para ficar em branco. Se a face já for branca, então ela é alterada de volta para seu valor original. Após a alteração ser feita, outro jogo de Ramvok pode começar (e durante esse jogo, a cada turno, o dado é rolado até que uma face com valor apareça). O jogador sabe quais faces estão em branco e quais não estão em todas as ocasiões. O jogo do Super Ramvok termina uma vez que todas as faces do dado estejam em branco.
|
||||||
|
|
||||||
Let S(d, c) be the expected profit that the player receives from an optimally-played game of Super Ramvok, given a fair d-sided die to start (with all sides visible), and cost constant c. For example, S(6, 1) = 208.3.
|
Considere $S(d, c)$ como o lucro esperado que o jogador recebe de um jogo ideal de Super Ramvok, levando em conta um dado de $d$ lados justo para começar (com todos os lados visíveis) e custo $c$ constante. Por exemplo, $S(6, 1) = 208,3$.
|
||||||
|
|
||||||
Let F(n) = ∑4≤d≤n ∑0≤c≤n S(d, c).
|
Considere $F(n) = \sum_{4 ≤ d ≤ n} \sum_{0 ≤ c ≤ n} S(d, c)$.
|
||||||
|
|
||||||
Calculate F(20), rounded to the nearest integer.
|
Calcule $F(20)$, arredondado para o número inteiro mais próximo.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler470()` should return 147668794.
|
`superRamvok()` deve retornar `147668794`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler470(), 147668794);
|
assert.strictEqual(superRamvok(), 147668794);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -35,12 +35,12 @@ assert.strictEqual(euler470(), 147668794);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler470() {
|
function superRamvok() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler470();
|
superRamvok();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f5431000cf542c510056
|
id: 5900f5431000cf542c510056
|
||||||
title: 'Problem 471: Triangle inscribed in ellipse'
|
title: 'Problema 471: Triângulo inscrito na elipse'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302148
|
forumTopicId: 302148
|
||||||
dashedName: problem-471-triangle-inscribed-in-ellipse
|
dashedName: problem-471-triangle-inscribed-in-ellipse
|
||||||
@ -8,20 +8,36 @@ dashedName: problem-471-triangle-inscribed-in-ellipse
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
The triangle ΔABC is inscribed in an ellipse with equation $\\frac {x^2} {a^2} + \\frac {y^2} {b^2} = 1$, 0 < 2b < a, a and b integers.
|
O triângulo $ΔABC$ está inscrito em uma elipse com equação $\frac{x^2}{a^2} + \frac{y^2}{b^2} = 1$, $0 < 2b < a$, $a$ e $b$ sendo números inteiros.
|
||||||
|
|
||||||
Let r(a,b) be the radius of the incircle of ΔABC when the incircle has center (2b, 0) and A has coordinates $\\left( \\frac a 2, \\frac {\\sqrt 3} 2 b\\right)$.
|
Considere $r(a, b)$ como o raio do círculo interno de $ΔABC$ quando este tem o centro $(2b, 0)$ e $A$ tem coordenadas $\left(\frac{a}{2}, \frac{\sqrt{3}}{2}b\right)$.
|
||||||
|
|
||||||
For example, r(3,1) = ½, r(6,2) = 1, r(12,3) = 2.
|
Por exemplo, $r(3, 1) = \frac{1}{2}, r(6, 2) = 1, r(12, 3) = 2$.
|
||||||
|
|
||||||
Let $G(n) = \\sum*{a=3}^n \\sum*{b=1}^{\\lfloor \\frac {a - 1} 2 \\rfloor} r(a, b)$ You are given G(10) = 20.59722222, G(100) = 19223.60980 (rounded to 10 significant digits). Find G(1011). Give your answer in scientific notation rounded to 10 significant digits. Use a lowercase e to separate mantissa and exponent. For G(10) the answer would have been 2.059722222e1.
|
<img class="img-responsive center-block" alt="triângulo ΔABC inscrito em uma elipse, raio do círculo interno de ΔABC r(6, 2) = 1" src="https://cdn.freecodecamp.org/curriculum/project-euler/triangle-inscribed-in-ellipse-1.png" style="background-color: white; padding: 10px;" />
|
||||||
|
|
||||||
|
<img class="img-responsive center-block" alt="triângulo ΔABC inscrito em uma elipse, raio do círculo interno de ΔABC r(12, 3) = 2" src="https://cdn.freecodecamp.org/curriculum/project-euler/triangle-inscribed-in-ellipse-2.png" style="background-color: white; padding: 10px;" />
|
||||||
|
|
||||||
|
Considere $G(n) = \sum_{a = 3}^n \sum_{b = 1}^{\left\lfloor\frac{a - 1}{2} \right\rfloor} r(a, b)$
|
||||||
|
|
||||||
|
Você é informado de que $G(10) = 20,59722222$, $G(100) = 19223,60980$ (arredondado para 10 dígitos significativos).
|
||||||
|
|
||||||
|
Encontre $G({10}^{11})$. Dê sua resposta como uma string em notação científica arredondada para 10 algarismos significativos. Use `e` em letra minúscula para separar a mantissa do expoente.
|
||||||
|
|
||||||
|
Para $G(10)$, a resposta seria `2.059722222e1`
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler471()` should return 1.895093981e+31.
|
`triangleInscribedInEllipse()` deve retornar uma string.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler471(), 1.895093981e31);
|
assert(typeof triangleInscribedInEllipse() === 'string');
|
||||||
|
```
|
||||||
|
|
||||||
|
`triangleInscribedInEllipse()` deve retornar a string `1.895093981e31`.
|
||||||
|
|
||||||
|
```js
|
||||||
|
assert.strictEqual(triangleInscribedInEllipse(), '1.895093981e31');
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -29,12 +45,12 @@ assert.strictEqual(euler471(), 1.895093981e31);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler471() {
|
function triangleInscribedInEllipse() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler471();
|
triangleInscribedInEllipse();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f5451000cf542c510057
|
id: 5900f5451000cf542c510057
|
||||||
title: 'Problem 472: Comfortable Distance II'
|
title: 'Problema 472: Distância confortável II'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302149
|
forumTopicId: 302149
|
||||||
dashedName: problem-472-comfortable-distance-ii
|
dashedName: problem-472-comfortable-distance-ii
|
||||||
@ -8,32 +8,32 @@ dashedName: problem-472-comfortable-distance-ii
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
There are N seats in a row. N people come one after another to fill the seats according to the following rules:
|
Existem $N$ assentos em uma fila. $N$ pessoas vêm umas atrás das outras para preencher os lugares de acordo com as seguintes regras:
|
||||||
|
|
||||||
No person sits beside another.
|
1. Nenhuma pessoa se senta ao lado de outra.
|
||||||
|
1. A primeira pessoa escolhe qualquer assento.
|
||||||
|
1. Cada pessoa subsequente escolhe o assento mais distante de qualquer outra pessoa já sentada, desde que não viole a regra 1. Se houver mais de uma escolha satisfazendo esta condição, então a pessoa escolhe a mais à esquerda.
|
||||||
|
|
||||||
The first person chooses any seat.
|
Observe que, devido à regra 1, alguns lugares certamente ficarão sem ocupação, e que o número máximo de pessoas que podem estar sentadas é menor que $N$ (para $N > 1$).
|
||||||
|
|
||||||
Each subsequent person chooses the seat furthest from anyone else already seated, as long as it does not violate rule 1. If there is more than one choice satisfying this condition, then the person chooses the leftmost choice.
|
Aqui estão os possíveis arranjos para $N = 15$:
|
||||||
|
|
||||||
Note that due to rule 1, some seats will surely be left unoccupied, and the maximum number of people that can be seated is less than N (for N > 1).
|
<img class="img-responsive center-block" alt="arranjo de assentos para N = 15" src="https://cdn.freecodecamp.org/curriculum/project-euler/comfortable-distance-ii.png" style="background-color: white; padding: 10px;" />
|
||||||
|
|
||||||
Here are the possible seating arrangements for N = 15:
|
Vemos que, se a primeira pessoa escolher corretamente, os 15 assentos podem acomodar até 7 pessoas. Vemos também que a primeira pessoa tem 9 opções para maximizar o número de pessoas que podem se sentar.
|
||||||
|
|
||||||
We see that if the first person chooses correctly, the 15 seats can seat up to 7 people. We can also see that the first person has 9 choices to maximize the number of people that may be seated.
|
Considere $f(N)$ como o número de escolhas que a primeira pessoa tem de maximizar o número de ocupantes para $N$ assentos em uma fila. Assim, $f(1) = 1$, $f(15) = 9$, $f(20) = 6$, e $f(500) = 16$.
|
||||||
|
|
||||||
Let f(N) be the number of choices the first person has to maximize the number of occupants for N seats in a row. Thus, f(1) = 1, f(15) = 9, f(20) = 6, and f(500) = 16.
|
Além disso, $\sum f(N) = 83$ para $1 ≤ N ≤ 20$ e $\sum f(N) = 13.343$ para $1 ≤ N ≤ 500$.
|
||||||
|
|
||||||
Also, ∑f(N) = 83 for 1 ≤ N ≤ 20 and ∑f(N) = 13343 for 1 ≤ N ≤ 500.
|
Encontre $\sum f(N)$ para $1 ≤ N ≤ {10}^{12}$. Dê os últimos 8 algarismos da sua resposta.
|
||||||
|
|
||||||
Find ∑f(N) for 1 ≤ N ≤ 1012. Give the last 8 digits of your answer.
|
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler472()` should return 73811586.
|
`comfortableDistanceTwo()` deve retornar `73811586`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler472(), 73811586);
|
assert.strictEqual(comfortableDistanceTwo(), 73811586);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -41,12 +41,12 @@ assert.strictEqual(euler472(), 73811586);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler472() {
|
function comfortableDistanceTwo() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler472();
|
comfortableDistanceTwo();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f5461000cf542c510058
|
id: 5900f5461000cf542c510058
|
||||||
title: 'Problem 473: Phigital number base'
|
title: 'Problema 473: Base de números phigitais'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 302150
|
forumTopicId: 302150
|
||||||
dashedName: problem-473-phigital-number-base
|
dashedName: problem-473-phigital-number-base
|
||||||
@ -8,30 +8,32 @@ dashedName: problem-473-phigital-number-base
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Let $\\varphi$ be the golden ratio: $\\varphi=\\frac{1+\\sqrt{5}}{2}.$
|
Considere $\varphi$ como a razão de ouro: $\varphi = \frac{1+\sqrt{5}}{2}.$
|
||||||
|
|
||||||
Remarkably it is possible to write every positive integer as a sum of powers of $\\varphi$ even if we require that every power of $\\varphi$ is used at most once in this sum.
|
Notadamente, é possível escrever cada número inteiro positivo como uma soma de potências de $\varphi$, mesmo se precisarmos que todas as potências de $\varphi$ sejam usadas no máximo uma vez nessa soma.
|
||||||
|
|
||||||
Even then this representation is not unique.
|
Mesmo assim, essa representação não é única.
|
||||||
|
|
||||||
We can make it unique by requiring that no powers with consecutive exponents are used and that the representation is finite.
|
Podemos torná-la única exigindo que nenhuma potência com expoentes consecutivos seja utilizada e que a representação seja finita.
|
||||||
|
|
||||||
E.g:
|
Ex:
|
||||||
|
|
||||||
$2=\\varphi+\\varphi^{-2}$ and $3=\\varphi^{2}+\\varphi^{-2}$
|
$2 = \varphi + \varphi^{-2}$ e $3 = \varphi^{2} + \varphi^{-2}$
|
||||||
|
|
||||||
To represent this sum of powers of $\\varphi$ we use a string of 0's and 1's with a point to indicate where the negative exponents start. We call this the representation in the phigital numberbase. So $1=1*{\\varphi}$, $2=10.01*{\\varphi}$, $3=100.01*{\\varphi}$ and $14=100100.001001*{\\varphi}$. The strings representing 1, 2 and 14 in the phigital number base are palindromic, while the string representing 3 is not. (the phigital point is not the middle character).
|
Para representar essa soma de potências de $\varphi$, usamos uma string de 0s e 1s com um ponto para indicar onde começam os expoentes negativos. Chamamos isto de representação na base numérica phigital.
|
||||||
|
|
||||||
The sum of the positive integers not exceeding 1000 whose phigital representation is palindromic is 4345.
|
Assim, $1 = 1_{\varphi}$, $2 = 10.01_{\varphi}$, $3 = 100.01_{\varphi}$ e $14 = 100100.001001_{\varphi}$. As strings representando 1, 2 e 14 na base numérica phigital são palindrômicas, enquanto a string representando 3 não é. (o ponto phigital não é o caractere do meio).
|
||||||
|
|
||||||
Find the sum of the positive integers not exceeding $10^{10}$ whose phigital representation is palindromic.
|
A soma de números inteiros positivos não excedendo1000 cuja representação phigital é palindrômica é 4345.
|
||||||
|
|
||||||
|
Encontre a soma de números inteiros positivos não excedendo $10^{10}$ cuja representação phigital é palindrômica.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler473()` should return 35856681704365.
|
`phigitalNumberBase()` deve retornar `35856681704365`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler473(), 35856681704365);
|
assert.strictEqual(phigitalNumberBase(), 35856681704365);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -39,12 +41,12 @@ assert.strictEqual(euler473(), 35856681704365);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler473() {
|
function phigitalNumberBase() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler473();
|
phigitalNumberBase();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user