QK6XE5XFT6XT6N2TAFLZTJAV3FWDDWXMXHHEE7MCFIUBRETV2HFQC use sum_of_multiples::*;#[test]fn no_multiples_within_limit() {assert_eq!(0, sum_of_multiples(1, &[3, 5]))}#[test]#[ignore]fn one_factor_has_multiples_within_limit() {assert_eq!(3, sum_of_multiples(4, &[3, 5]))}#[test]#[ignore]fn more_than_one_multiple_within_limit() {assert_eq!(9, sum_of_multiples(7, &[3]))}#[test]#[ignore]fn more_than_one_factor_with_multiples_within_limit() {assert_eq!(23, sum_of_multiples(10, &[3, 5]))}#[test]#[ignore]fn each_multiple_is_only_counted_once() {assert_eq!(2318, sum_of_multiples(100, &[3, 5]))}#[test]#[ignore]fn a_much_larger_limit() {assert_eq!(233_168, sum_of_multiples(1000, &[3, 5]))}#[test]#[ignore]fn three_factors() {assert_eq!(51, sum_of_multiples(20, &[7, 13, 17]))}#[test]#[ignore]fn factors_not_relatively_prime() {assert_eq!(30, sum_of_multiples(15, &[4, 6]))}#[test]#[ignore]fn some_pairs_of_factors_relatively_prime_and_some_not() {assert_eq!(4419, sum_of_multiples(150, &[5, 6, 8]))}#[test]#[ignore]fn one_factor_is_a_multiple_of_another() {assert_eq!(275, sum_of_multiples(51, &[5, 25]))}#[test]#[ignore]fn much_larger_factors() {assert_eq!(2_203_160, sum_of_multiples(10_000, &[43, 47]))}#[test]#[ignore]fn all_numbers_are_multiples_of_1() {assert_eq!(4950, sum_of_multiples(100, &[1]))}#[test]#[ignore]fn no_factors_means_an_empty_sum() {assert_eq!(0, sum_of_multiples(10_000, &[]))}#[test]#[ignore]fn the_only_multiple_of_0_is_0() {assert_eq!(0, sum_of_multiples(1, &[0]))}#[test]#[ignore]fn the_factor_0_does_not_affect_the_sum_of_multiples_of_other_factors() {assert_eq!(3, sum_of_multiples(4, &[3, 0]))}#[test]#[ignore]fn solutions_using_include_exclude_must_extend_to_cardinality_greater_than_3() {assert_eq!(39_614_537, sum_of_multiples(10_000, &[2, 3, 5, 7, 11]))}
pub fn sum_of_multiples(limit: u32, factors: &[u32]) -> u32 {unimplemented!("Sum the multiples of all of {:?} which are less than {}",factors,limit)}
# Sum Of MultiplesGiven a number, find the sum of all the unique multiples of particular numbers up tobut not including that number.If we list all the natural numbers below 20 that are multiples of 3 or 5,we get 3, 5, 6, 9, 10, 12, 15, and 18.The sum of these multiples is 78.## Rust InstallationRefer to the [exercism help page][help-page] for Rust installation and learningresources.## Writing the CodeExecute the tests with:```bash$ cargo test```All but the first test have been ignored. After you get the first test topass, open the tests source file which is located in the `tests` directoryand remove the `#[ignore]` flag from the next test and get the tests to passagain. Each separate test is a function with `#[test]` flag above it.Continue, until you pass every test.If you wish to run all ignored tests without editing the tests source file, use:```bash$ cargo test -- --ignored```To run a specific test, for example `some_test`, you can use:```bash$ cargo test some_test```If the specific test is ignored use:```bash$ cargo test some_test -- --ignored```To learn more about Rust tests refer to the [online test documentation][rust-tests]Make sure to read the [Modules][modules] chapter if youhaven't already, it will help you with organizing your files.## Further improvementsAfter you have solved the exercise, please consider using the additional utilities, described in the [installation guide](https://exercism.io/tracks/rust/installation), to further refine your final solution.To format your solution, inside the solution directory use```bashcargo fmt```To see, if your solution contains some common ineffective use cases, inside the solution directory use```bashcargo clippy --all-targets```## Submitting the solutionGenerally you should submit all files in which you implemented your solution (`src/lib.rs` in most cases). If you are using any external crates, please consider submitting the `Cargo.toml` file. This will make the review process faster and clearer.## Feedback, Issues, Pull RequestsThe [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help!If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/main/contributing-to-language-tracks/README.md).[help-page]: https://exercism.io/tracks/rust/learning[modules]: https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html[cargo]: https://doc.rust-lang.org/book/ch14-00-more-about-cargo.html[rust-tests]: https://doc.rust-lang.org/book/ch11-02-running-tests.html## SourceA variation on Problem 1 at Project Euler [http://projecteuler.net/problem=1](http://projecteuler.net/problem=1)## Submitting Incomplete SolutionsIt's possible to submit an incomplete solution so you can see how others have completed the exercise.
[package]edition = "2018"name = "sum-of-multiples"version = "1.5.0"
# Generated by Cargo# will have compiled files and executables/target/**/*.rs.bk# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries# More information here http://doc.crates.io/guide.html#cargotoml-vs-cargolockCargo.lock
{"track":"rust","exercise":"sum-of-multiples","id":"2b7b4f8c8ffd4ef3af01ffdf91160f8a","url":"https://exercism.io/my/solutions/2b7b4f8c8ffd4ef3af01ffdf91160f8a","handle":"nicoty","is_requester":true,"auto_approve":false}
//! Tests for reverse-string//!//! Generated by [script][script] using [canonical data][canonical-data]//!//! [script]: https://github.com/exercism/rust/blob/b829ce2/bin/init_exercise.py//! [canonical-data]: https://raw.githubusercontent.com/exercism/problem-specifications/main/exercises/reverse-string/canonical_data.jsonuse reverse_string::*;/// Process a single test case for the property `reverse`fn process_reverse_case(input: &str, expected: &str) {assert_eq!(&reverse(input), expected)}#[test]/// empty stringfn test_an_empty_string() {process_reverse_case("", "");}#[test]#[ignore]/// a wordfn test_a_word() {process_reverse_case("robot", "tobor");}#[test]#[ignore]/// a capitalized wordfn test_a_capitalized_word() {process_reverse_case("Ramen", "nemaR");}#[test]#[ignore]/// a sentence with punctuationfn test_a_sentence_with_punctuation() {process_reverse_case("I'm hungry!", "!yrgnuh m'I");}#[test]#[ignore]/// a palindromefn test_a_palindrome() {process_reverse_case("racecar", "racecar");}#[test]#[ignore]/// an even-sized wordfn test_an_even_sized_word() {process_reverse_case("drawer", "reward");}#[test]#[ignore]/// wide charactersfn test_wide_characters() {process_reverse_case("子猫", "猫子");}#[test]#[ignore]#[cfg(feature = "grapheme")]/// grapheme clustersfn test_grapheme_clusters() {process_reverse_case("uüu", "uüu");}
pub fn reverse(input: &str) -> String {unimplemented!("Write a function to reverse {}", input);}
# Reverse StringReverse a stringFor example:input: "cool"output: "looc"## BonusTest your function on this string: `uüu` and see what happens. Try to write a function that properlyreverses this string. Hint: grapheme clustersTo get the bonus test to run, remove the ignore flag (`#[ignore]`) from thelast test, and execute the tests with:```bash$ cargo test --features grapheme```You will need to use external libraries (a `crate` in rust lingo) for the bonus task. A good place to look for those is [crates.io](https://crates.io/), the official repository of crates.[Check the documentation](https://doc.rust-lang.org/cargo/guide/dependencies.html) for instructions on how to use external crates in your projects.## Rust InstallationRefer to the [exercism help page][help-page] for Rust installation and learningresources.## Writing the CodeExecute the tests with:```bash$ cargo test```All but the first test have been ignored. After you get the first test topass, open the tests source file which is located in the `tests` directoryand remove the `#[ignore]` flag from the next test and get the tests to passagain. Each separate test is a function with `#[test]` flag above it.Continue, until you pass every test.If you wish to run all ignored tests without editing the tests source file, use:```bash$ cargo test -- --ignored```To run a specific test, for example `some_test`, you can use:```bash$ cargo test some_test```If the specific test is ignored use:```bash$ cargo test some_test -- --ignored```To learn more about Rust tests refer to the [online test documentation][rust-tests]Make sure to read the [Modules][modules] chapter if youhaven't already, it will help you with organizing your files.## Further improvementsAfter you have solved the exercise, please consider using the additional utilities, described in the [installation guide](https://exercism.io/tracks/rust/installation), to further refine your final solution.To format your solution, inside the solution directory use```bashcargo fmt```To see, if your solution contains some common ineffective use cases, inside the solution directory use```bashcargo clippy --all-targets```## Submitting the solutionGenerally you should submit all files in which you implemented your solution (`src/lib.rs` in most cases). If you are using any external crates, please consider submitting the `Cargo.toml` file. This will make the review process faster and clearer.## Feedback, Issues, Pull RequestsThe [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help!If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/main/contributing-to-language-tracks/README.md).[help-page]: https://exercism.io/tracks/rust/learning[modules]: https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html[cargo]: https://doc.rust-lang.org/book/ch14-00-more-about-cargo.html[rust-tests]: https://doc.rust-lang.org/book/ch11-02-running-tests.html## SourceIntroductory challenge to reverse an input string [https://medium.freecodecamp.org/how-to-reverse-a-string-in-javascript-in-3-different-ways-75e4763c68cb](https://medium.freecodecamp.org/how-to-reverse-a-string-in-javascript-in-3-different-ways-75e4763c68cb)## Submitting Incomplete SolutionsIt's possible to submit an incomplete solution so you can see how others have completed the exercise.
[dependencies][features]grapheme = [][package]edition = "2018"name = "reverse_string"version = "1.2.0"
# Generated by Cargo# will have compiled files and executables/target/**/*.rs.bk# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries# More information here http://doc.crates.io/guide.html#cargotoml-vs-cargolockCargo.lock
{"track":"rust","exercise":"reverse-string","id":"2a5054a3e0c740629a3b162300bf3f0c","url":"https://exercism.io/my/solutions/2a5054a3e0c740629a3b162300bf3f0c","handle":"nicoty","is_requester":true,"auto_approve":false}
use proverb::build_proverb;#[test]fn test_two_pieces() {let input = vec!["nail", "shoe"];let expected = vec!["For want of a nail the shoe was lost.","And all for the want of a nail.",].join("\n");assert_eq!(build_proverb(&input), expected);}// Notice the change in the last line at three pieces.#[test]#[ignore]fn test_three_pieces() {let input = vec!["nail", "shoe", "horse"];let expected = vec!["For want of a nail the shoe was lost.","For want of a shoe the horse was lost.","And all for the want of a nail.",].join("\n");assert_eq!(build_proverb(&input), expected);}#[test]#[ignore]fn test_one_piece() {let input = vec!["nail"];let expected = String::from("And all for the want of a nail.");assert_eq!(build_proverb(&input), expected);}#[test]#[ignore]fn test_zero_pieces() {let input: Vec<&str> = vec![];let expected = String::new();assert_eq!(build_proverb(&input), expected);}#[test]#[ignore]fn test_full() {let input = vec!["nail", "shoe", "horse", "rider", "message", "battle", "kingdom",];let expected = vec!["For want of a nail the shoe was lost.","For want of a shoe the horse was lost.","For want of a horse the rider was lost.","For want of a rider the message was lost.","For want of a message the battle was lost.","For want of a battle the kingdom was lost.","And all for the want of a nail.",].join("\n");assert_eq!(build_proverb(&input), expected);}#[test]#[ignore]fn test_three_pieces_modernized() {let input = vec!["pin", "gun", "soldier", "battle"];let expected = vec!["For want of a pin the gun was lost.","For want of a gun the soldier was lost.","For want of a soldier the battle was lost.","And all for the want of a pin.",].join("\n");assert_eq!(build_proverb(&input), expected);}
pub fn build_proverb(list: &[&str]) -> String {unimplemented!("build a proverb from this list of items: {:?}", list)}
# ProverbFor want of a horseshoe nail, a kingdom was lost, or so the saying goes.Given a list of inputs, generate the relevant proverb. For example, given the list `["nail", "shoe", "horse", "rider", "message", "battle", "kingdom"]`, you will output the full text of this proverbial rhyme:```textFor want of a nail the shoe was lost.For want of a shoe the horse was lost.For want of a horse the rider was lost.For want of a rider the message was lost.For want of a message the battle was lost.For want of a battle the kingdom was lost.And all for the want of a nail.```Note that the list of inputs may vary; your solution should be able to handle lists of arbitrary length and content. No line of the output text should be a static, unchanging string; all should vary according to the input given.## Rust InstallationRefer to the [exercism help page][help-page] for Rust installation and learningresources.## Writing the CodeExecute the tests with:```bash$ cargo test```All but the first test have been ignored. After you get the first test topass, open the tests source file which is located in the `tests` directoryand remove the `#[ignore]` flag from the next test and get the tests to passagain. Each separate test is a function with `#[test]` flag above it.Continue, until you pass every test.If you wish to run all ignored tests without editing the tests source file, use:```bash$ cargo test -- --ignored```To run a specific test, for example `some_test`, you can use:```bash$ cargo test some_test```If the specific test is ignored use:```bash$ cargo test some_test -- --ignored```To learn more about Rust tests refer to the [online test documentation][rust-tests]Make sure to read the [Modules][modules] chapter if youhaven't already, it will help you with organizing your files.## Further improvementsAfter you have solved the exercise, please consider using the additional utilities, described in the [installation guide](https://exercism.io/tracks/rust/installation), to further refine your final solution.To format your solution, inside the solution directory use```bashcargo fmt```To see, if your solution contains some common ineffective use cases, inside the solution directory use```bashcargo clippy --all-targets```## Submitting the solutionGenerally you should submit all files in which you implemented your solution (`src/lib.rs` in most cases). If you are using any external crates, please consider submitting the `Cargo.toml` file. This will make the review process faster and clearer.## Feedback, Issues, Pull RequestsThe [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help!If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/main/contributing-to-language-tracks/README.md).[help-page]: https://exercism.io/tracks/rust/learning[modules]: https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html[cargo]: https://doc.rust-lang.org/book/ch14-00-more-about-cargo.html[rust-tests]: https://doc.rust-lang.org/book/ch11-02-running-tests.html## SourceWikipedia [http://en.wikipedia.org/wiki/For_Want_of_a_Nail](http://en.wikipedia.org/wiki/For_Want_of_a_Nail)## Submitting Incomplete SolutionsIt's possible to submit an incomplete solution so you can see how others have completed the exercise.
[package]edition = "2018"name = "proverb"version = "1.1.0"[dependencies]
# Generated by Cargo# will have compiled files and executables/target/**/*.rs.bk# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries# More information here http://doc.crates.io/guide.html#cargotoml-vs-cargolockCargo.lock
{"track":"rust","exercise":"proverb","id":"e9909a7abc5945479b5963a96e1c6bd0","url":"https://exercism.io/my/solutions/e9909a7abc5945479b5963a96e1c6bd0","handle":"nicoty","is_requester":true,"auto_approve":false}
use prime_factors::factors;#[test]fn test_no_factors() {assert_eq!(factors(1), vec![]);}#[test]#[ignore]fn test_prime_number() {assert_eq!(factors(2), vec![2]);}#[test]#[ignore]fn test_square_of_a_prime() {assert_eq!(factors(9), vec![3, 3]);}#[test]#[ignore]fn test_cube_of_a_prime() {assert_eq!(factors(8), vec![2, 2, 2]);}#[test]#[ignore]fn test_product_of_primes_and_non_primes() {assert_eq!(factors(12), vec![2, 2, 3]);}#[test]#[ignore]fn test_product_of_primes() {assert_eq!(factors(901_255), vec![5, 17, 23, 461]);}#[test]#[ignore]fn test_factors_include_large_prime() {assert_eq!(factors(93_819_012_551), vec![11, 9539, 894_119]);}
pub fn factors(n: u64) -> Vec<u64> {unimplemented!("This should calculate the prime factors of {}", n)}
# Prime FactorsCompute the prime factors of a given natural number.A prime number is only evenly divisible by itself and 1.Note that 1 is not a prime number.## ExampleWhat are the prime factors of 60?- Our first divisor is 2. 2 goes into 60, leaving 30.- 2 goes into 30, leaving 15.- 2 doesn't go cleanly into 15. So let's move on to our next divisor, 3.- 3 goes cleanly into 15, leaving 5.- 3 does not go cleanly into 5. The next possible factor is 4.- 4 does not go cleanly into 5. The next possible factor is 5.- 5 does go cleanly into 5.- We're left only with 1, so now, we're done.Our successful divisors in that computation represent the list of primefactors of 60: 2, 2, 3, and 5.You can check this yourself:- 2 * 2 * 3 * 5- = 4 * 15- = 60- Success!## Rust InstallationRefer to the [exercism help page][help-page] for Rust installation and learningresources.## Writing the CodeExecute the tests with:```bash$ cargo test```All but the first test have been ignored. After you get the first test topass, open the tests source file which is located in the `tests` directoryand remove the `#[ignore]` flag from the next test and get the tests to passagain. Each separate test is a function with `#[test]` flag above it.Continue, until you pass every test.If you wish to run all ignored tests without editing the tests source file, use:```bash$ cargo test -- --ignored```To run a specific test, for example `some_test`, you can use:```bash$ cargo test some_test```If the specific test is ignored use:```bash$ cargo test some_test -- --ignored```To learn more about Rust tests refer to the [online test documentation][rust-tests]Make sure to read the [Modules][modules] chapter if youhaven't already, it will help you with organizing your files.## Further improvementsAfter you have solved the exercise, please consider using the additional utilities, described in the [installation guide](https://exercism.io/tracks/rust/installation), to further refine your final solution.To format your solution, inside the solution directory use```bashcargo fmt```To see, if your solution contains some common ineffective use cases, inside the solution directory use```bashcargo clippy --all-targets```## Submitting the solutionGenerally you should submit all files in which you implemented your solution (`src/lib.rs` in most cases). If you are using any external crates, please consider submitting the `Cargo.toml` file. This will make the review process faster and clearer.## Feedback, Issues, Pull RequestsThe [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help!If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/main/contributing-to-language-tracks/README.md).[help-page]: https://exercism.io/tracks/rust/learning[modules]: https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html[cargo]: https://doc.rust-lang.org/book/ch14-00-more-about-cargo.html[rust-tests]: https://doc.rust-lang.org/book/ch11-02-running-tests.html## SourceThe Prime Factors Kata by Uncle Bob [http://butunclebob.com/ArticleS.UncleBob.ThePrimeFactorsKata](http://butunclebob.com/ArticleS.UncleBob.ThePrimeFactorsKata)## Submitting Incomplete SolutionsIt's possible to submit an incomplete solution so you can see how others have completed the exercise.
[package]edition = "2018"name = "prime_factors"version = "1.1.0"[dependencies]
# Generated by Cargo# will have compiled files and executables/target/**/*.rs.bk# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries# More information here http://doc.crates.io/guide.html#cargotoml-vs-cargolockCargo.lock
{"track":"rust","exercise":"prime-factors","id":"3fb0613cf72147deab66b3a6adb5ab8f","url":"https://exercism.io/my/solutions/3fb0613cf72147deab66b3a6adb5ab8f","handle":"nicoty","is_requester":true,"auto_approve":false}
fn process_square_case(input: u32, expected: u64) {assert_eq!(grains::square(input), expected);}#[test]/// 1fn test_1() {process_square_case(1, 1);}#[test]#[ignore]/// 2fn test_2() {process_square_case(2, 2);}#[test]#[ignore]/// 3fn test_3() {process_square_case(3, 4);}#[test]#[ignore]/// 4fn test_4() {process_square_case(4, 8);}//NEW#[test]#[ignore]/// 16fn test_16() {process_square_case(16, 32_768);}#[test]#[ignore]/// 32fn test_32() {process_square_case(32, 2_147_483_648);}#[test]#[ignore]/// 64fn test_64() {process_square_case(64, 9_223_372_036_854_775_808);}#[test]#[ignore]#[should_panic(expected = "Square must be between 1 and 64")]fn test_square_0_raises_an_exception() {grains::square(0);}#[test]#[ignore]#[should_panic(expected = "Square must be between 1 and 64")]fn test_square_greater_than_64_raises_an_exception() {grains::square(65);}#[test]#[ignore]fn test_returns_the_total_number_of_grains_on_the_board() {assert_eq!(grains::total(), 18_446_744_073_709_551_615);}
pub fn square(s: u32) -> u64 {unimplemented!("grains of rice on square {}", s);}pub fn total() -> u64 {unimplemented!();}
# GrainsCalculate the number of grains of wheat on a chessboard given that the numberon each square doubles.There once was a wise servant who saved the life of a prince. The kingpromised to pay whatever the servant could dream up. Knowing that theking loved chess, the servant told the king he would like to have grainsof wheat. One grain on the first square of a chess board, with the numberof grains doubling on each successive square.There are 64 squares on a chessboard (where square 1 has one grain, square 2 has two grains, and so on).Write code that shows:- how many grains were on a given square, and- the total number of grains on the chessboard## For bonus pointsDid you get the tests passing and the code clean? If you want to, theseare some additional things you could try:- Optimize for speed.- Optimize for readability.Then please share your thoughts in a comment on the submission. Did thisexperiment make the code better? Worse? Did you learn anything from it?## Rust InstallationRefer to the [exercism help page][help-page] for Rust installation and learningresources.## Writing the CodeExecute the tests with:```bash$ cargo test```All but the first test have been ignored. After you get the first test topass, open the tests source file which is located in the `tests` directoryand remove the `#[ignore]` flag from the next test and get the tests to passagain. Each separate test is a function with `#[test]` flag above it.Continue, until you pass every test.If you wish to run all ignored tests without editing the tests source file, use:```bash$ cargo test -- --ignored```To run a specific test, for example `some_test`, you can use:```bash$ cargo test some_test```If the specific test is ignored use:```bash$ cargo test some_test -- --ignored```To learn more about Rust tests refer to the [online test documentation][rust-tests]Make sure to read the [Modules][modules] chapter if youhaven't already, it will help you with organizing your files.## Further improvementsAfter you have solved the exercise, please consider using the additional utilities, described in the [installation guide](https://exercism.io/tracks/rust/installation), to further refine your final solution.To format your solution, inside the solution directory use```bashcargo fmt```To see, if your solution contains some common ineffective use cases, inside the solution directory use```bashcargo clippy --all-targets```## Submitting the solutionGenerally you should submit all files in which you implemented your solution (`src/lib.rs` in most cases). If you are using any external crates, please consider submitting the `Cargo.toml` file. This will make the review process faster and clearer.## Feedback, Issues, Pull RequestsThe [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help!If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/main/contributing-to-language-tracks/README.md).[help-page]: https://exercism.io/tracks/rust/learning[modules]: https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html[cargo]: https://doc.rust-lang.org/book/ch14-00-more-about-cargo.html[rust-tests]: https://doc.rust-lang.org/book/ch11-02-running-tests.html## SourceJavaRanch Cattle Drive, exercise 6 [http://www.javaranch.com/grains.jsp](http://www.javaranch.com/grains.jsp)## Submitting Incomplete SolutionsIt's possible to submit an incomplete solution so you can see how others have completed the exercise.
[package]edition = "2018"name = "grains"version = "1.2.0"
# Generated by Cargo# will have compiled files and executables/target/**/*.rs.bk# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries# More information here http://doc.crates.io/guide.html#cargotoml-vs-cargolockCargo.lock
{"track":"rust","exercise":"grains","id":"0fd4e4f19be04529a86708bea237cef1","url":"https://exercism.io/my/solutions/0fd4e4f19be04529a86708bea237cef1","handle":"nicoty","is_requester":true,"auto_approve":false}
use difference_of_squares as squares;#[test]fn test_square_of_sum_1() {assert_eq!(1, squares::square_of_sum(1));}#[test]#[ignore]fn test_square_of_sum_5() {assert_eq!(225, squares::square_of_sum(5));}#[test]#[ignore]fn test_square_of_sum_100() {assert_eq!(25_502_500, squares::square_of_sum(100));}#[test]#[ignore]fn test_sum_of_squares_1() {assert_eq!(1, squares::sum_of_squares(1));}#[test]#[ignore]fn test_sum_of_squares_5() {assert_eq!(55, squares::sum_of_squares(5));}#[test]#[ignore]fn test_sum_of_squares_100() {assert_eq!(338_350, squares::sum_of_squares(100));}#[test]#[ignore]fn test_difference_1() {assert_eq!(0, squares::difference(1));}#[test]#[ignore]fn test_difference_5() {assert_eq!(170, squares::difference(5));}#[test]#[ignore]fn test_difference_100() {assert_eq!(25_164_150, squares::difference(100));}
pub fn square_of_sum(n: u32) -> u32 {unimplemented!("square of sum of 1...{}", n)}pub fn sum_of_squares(n: u32) -> u32 {unimplemented!("sum of squares of 1...{}", n)}pub fn difference(n: u32) -> u32 {unimplemented!("difference between square of sum of 1...{n} and sum of squares of 1...{n}",n = n,)}
# Difference Of SquaresFind the difference between the square of the sum and the sum of the squares of the first N natural numbers.The square of the sum of the first ten natural numbers is(1 + 2 + ... + 10)² = 55² = 3025.The sum of the squares of the first ten natural numbers is1² + 2² + ... + 10² = 385.Hence the difference between the square of the sum of the firstten natural numbers and the sum of the squares of the first tennatural numbers is 3025 - 385 = 2640.You are not expected to discover an efficient solution to this yourself fromfirst principles; research is allowed, indeed, encouraged. Finding the bestalgorithm for the problem is a key skill in software engineering.## Rust InstallationRefer to the [exercism help page][help-page] for Rust installation and learningresources.## Writing the CodeExecute the tests with:```bash$ cargo test```All but the first test have been ignored. After you get the first test topass, open the tests source file which is located in the `tests` directoryand remove the `#[ignore]` flag from the next test and get the tests to passagain. Each separate test is a function with `#[test]` flag above it.Continue, until you pass every test.If you wish to run all ignored tests without editing the tests source file, use:```bash$ cargo test -- --ignored```To run a specific test, for example `some_test`, you can use:```bash$ cargo test some_test```If the specific test is ignored use:```bash$ cargo test some_test -- --ignored```To learn more about Rust tests refer to the [online test documentation][rust-tests]Make sure to read the [Modules][modules] chapter if youhaven't already, it will help you with organizing your files.## Further improvementsAfter you have solved the exercise, please consider using the additional utilities, described in the [installation guide](https://exercism.io/tracks/rust/installation), to further refine your final solution.To format your solution, inside the solution directory use```bashcargo fmt```To see, if your solution contains some common ineffective use cases, inside the solution directory use```bashcargo clippy --all-targets```## Submitting the solutionGenerally you should submit all files in which you implemented your solution (`src/lib.rs` in most cases). If you are using any external crates, please consider submitting the `Cargo.toml` file. This will make the review process faster and clearer.## Feedback, Issues, Pull RequestsThe [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help!If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/main/contributing-to-language-tracks/README.md).[help-page]: https://exercism.io/tracks/rust/learning[modules]: https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html[cargo]: https://doc.rust-lang.org/book/ch14-00-more-about-cargo.html[rust-tests]: https://doc.rust-lang.org/book/ch11-02-running-tests.html## SourceProblem 6 at Project Euler [http://projecteuler.net/problem=6](http://projecteuler.net/problem=6)## Submitting Incomplete SolutionsIt's possible to submit an incomplete solution so you can see how others have completed the exercise.
[package]edition = "2018"name = "difference-of-squares"version = "1.2.0"
# Generated by Cargo# will have compiled files and executables/target/**/*.rs.bk# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries# More information here http://doc.crates.io/guide.html#cargotoml-vs-cargolockCargo.lock
{"track":"rust","exercise":"difference-of-squares","id":"d5414784cdab43e583e594c55f9cf99b","url":"https://exercism.io/my/solutions/d5414784cdab43e583e594c55f9cf99b","handle":"nicoty","is_requester":true,"auto_approve":false}
use beer_song as beer;#[test]fn test_verse_0() {assert_eq!(beer::verse(0), "No more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.\n");}#[test]#[ignore]fn test_verse_1() {assert_eq!(beer::verse(1), "1 bottle of beer on the wall, 1 bottle of beer.\nTake it down and pass it around, no more bottles of beer on the wall.\n");}#[test]#[ignore]fn test_verse_2() {assert_eq!(beer::verse(2), "2 bottles of beer on the wall, 2 bottles of beer.\nTake one down and pass it around, 1 bottle of beer on the wall.\n");}#[test]#[ignore]fn test_verse_8() {assert_eq!(beer::verse(8), "8 bottles of beer on the wall, 8 bottles of beer.\nTake one down and pass it around, 7 bottles of beer on the wall.\n");}#[test]#[ignore]fn test_song_8_6() {assert_eq!(beer::sing(8, 6), "8 bottles of beer on the wall, 8 bottles of beer.\nTake one down and pass it around, 7 bottles of beer on the wall.\n\n7 bottles of beer on the wall, 7 bottles of beer.\nTake one down and pass it around, 6 bottles of beer on the wall.\n\n6 bottles of beer on the wall, 6 bottles of beer.\nTake one down and pass it around, 5 bottles of beer on the wall.\n");}#[test]#[ignore]fn test_song_3_0() {assert_eq!(beer::sing(3, 0), "3 bottles of beer on the wall, 3 bottles of beer.\nTake one down and pass it around, 2 bottles of beer on the wall.\n\n2 bottles of beer on the wall, 2 bottles of beer.\nTake one down and pass it around, 1 bottle of beer on the wall.\n\n1 bottle of beer on the wall, 1 bottle of beer.\nTake it down and pass it around, no more bottles of beer on the wall.\n\nNo more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.\n");}
pub fn verse(n: u32) -> String {unimplemented!("emit verse {}", n)}pub fn sing(start: u32, end: u32) -> String {unimplemented!("sing verses {} to {}, inclusive", start, end)}
# Beer SongRecite the lyrics to that beloved classic, that field-trip favorite: 99 Bottles of Beer on the Wall.Note that not all verses are identical.```text99 bottles of beer on the wall, 99 bottles of beer.Take one down and pass it around, 98 bottles of beer on the wall.98 bottles of beer on the wall, 98 bottles of beer.Take one down and pass it around, 97 bottles of beer on the wall.97 bottles of beer on the wall, 97 bottles of beer.Take one down and pass it around, 96 bottles of beer on the wall.96 bottles of beer on the wall, 96 bottles of beer.Take one down and pass it around, 95 bottles of beer on the wall.95 bottles of beer on the wall, 95 bottles of beer.Take one down and pass it around, 94 bottles of beer on the wall.94 bottles of beer on the wall, 94 bottles of beer.Take one down and pass it around, 93 bottles of beer on the wall.93 bottles of beer on the wall, 93 bottles of beer.Take one down and pass it around, 92 bottles of beer on the wall.92 bottles of beer on the wall, 92 bottles of beer.Take one down and pass it around, 91 bottles of beer on the wall.91 bottles of beer on the wall, 91 bottles of beer.Take one down and pass it around, 90 bottles of beer on the wall.90 bottles of beer on the wall, 90 bottles of beer.Take one down and pass it around, 89 bottles of beer on the wall.89 bottles of beer on the wall, 89 bottles of beer.Take one down and pass it around, 88 bottles of beer on the wall.88 bottles of beer on the wall, 88 bottles of beer.Take one down and pass it around, 87 bottles of beer on the wall.87 bottles of beer on the wall, 87 bottles of beer.Take one down and pass it around, 86 bottles of beer on the wall.86 bottles of beer on the wall, 86 bottles of beer.Take one down and pass it around, 85 bottles of beer on the wall.85 bottles of beer on the wall, 85 bottles of beer.Take one down and pass it around, 84 bottles of beer on the wall.84 bottles of beer on the wall, 84 bottles of beer.Take one down and pass it around, 83 bottles of beer on the wall.83 bottles of beer on the wall, 83 bottles of beer.Take one down and pass it around, 82 bottles of beer on the wall.82 bottles of beer on the wall, 82 bottles of beer.Take one down and pass it around, 81 bottles of beer on the wall.81 bottles of beer on the wall, 81 bottles of beer.Take one down and pass it around, 80 bottles of beer on the wall.80 bottles of beer on the wall, 80 bottles of beer.Take one down and pass it around, 79 bottles of beer on the wall.79 bottles of beer on the wall, 79 bottles of beer.Take one down and pass it around, 78 bottles of beer on the wall.78 bottles of beer on the wall, 78 bottles of beer.Take one down and pass it around, 77 bottles of beer on the wall.77 bottles of beer on the wall, 77 bottles of beer.Take one down and pass it around, 76 bottles of beer on the wall.76 bottles of beer on the wall, 76 bottles of beer.Take one down and pass it around, 75 bottles of beer on the wall.75 bottles of beer on the wall, 75 bottles of beer.Take one down and pass it around, 74 bottles of beer on the wall.74 bottles of beer on the wall, 74 bottles of beer.Take one down and pass it around, 73 bottles of beer on the wall.73 bottles of beer on the wall, 73 bottles of beer.Take one down and pass it around, 72 bottles of beer on the wall.72 bottles of beer on the wall, 72 bottles of beer.Take one down and pass it around, 71 bottles of beer on the wall.71 bottles of beer on the wall, 71 bottles of beer.Take one down and pass it around, 70 bottles of beer on the wall.70 bottles of beer on the wall, 70 bottles of beer.Take one down and pass it around, 69 bottles of beer on the wall.69 bottles of beer on the wall, 69 bottles of beer.Take one down and pass it around, 68 bottles of beer on the wall.68 bottles of beer on the wall, 68 bottles of beer.Take one down and pass it around, 67 bottles of beer on the wall.67 bottles of beer on the wall, 67 bottles of beer.Take one down and pass it around, 66 bottles of beer on the wall.66 bottles of beer on the wall, 66 bottles of beer.Take one down and pass it around, 65 bottles of beer on the wall.65 bottles of beer on the wall, 65 bottles of beer.Take one down and pass it around, 64 bottles of beer on the wall.64 bottles of beer on the wall, 64 bottles of beer.Take one down and pass it around, 63 bottles of beer on the wall.63 bottles of beer on the wall, 63 bottles of beer.Take one down and pass it around, 62 bottles of beer on the wall.62 bottles of beer on the wall, 62 bottles of beer.Take one down and pass it around, 61 bottles of beer on the wall.61 bottles of beer on the wall, 61 bottles of beer.Take one down and pass it around, 60 bottles of beer on the wall.60 bottles of beer on the wall, 60 bottles of beer.Take one down and pass it around, 59 bottles of beer on the wall.59 bottles of beer on the wall, 59 bottles of beer.Take one down and pass it around, 58 bottles of beer on the wall.58 bottles of beer on the wall, 58 bottles of beer.Take one down and pass it around, 57 bottles of beer on the wall.57 bottles of beer on the wall, 57 bottles of beer.Take one down and pass it around, 56 bottles of beer on the wall.56 bottles of beer on the wall, 56 bottles of beer.Take one down and pass it around, 55 bottles of beer on the wall.55 bottles of beer on the wall, 55 bottles of beer.Take one down and pass it around, 54 bottles of beer on the wall.54 bottles of beer on the wall, 54 bottles of beer.Take one down and pass it around, 53 bottles of beer on the wall.53 bottles of beer on the wall, 53 bottles of beer.Take one down and pass it around, 52 bottles of beer on the wall.52 bottles of beer on the wall, 52 bottles of beer.Take one down and pass it around, 51 bottles of beer on the wall.51 bottles of beer on the wall, 51 bottles of beer.Take one down and pass it around, 50 bottles of beer on the wall.50 bottles of beer on the wall, 50 bottles of beer.Take one down and pass it around, 49 bottles of beer on the wall.49 bottles of beer on the wall, 49 bottles of beer.Take one down and pass it around, 48 bottles of beer on the wall.48 bottles of beer on the wall, 48 bottles of beer.Take one down and pass it around, 47 bottles of beer on the wall.47 bottles of beer on the wall, 47 bottles of beer.Take one down and pass it around, 46 bottles of beer on the wall.46 bottles of beer on the wall, 46 bottles of beer.Take one down and pass it around, 45 bottles of beer on the wall.45 bottles of beer on the wall, 45 bottles of beer.Take one down and pass it around, 44 bottles of beer on the wall.44 bottles of beer on the wall, 44 bottles of beer.Take one down and pass it around, 43 bottles of beer on the wall.43 bottles of beer on the wall, 43 bottles of beer.Take one down and pass it around, 42 bottles of beer on the wall.42 bottles of beer on the wall, 42 bottles of beer.Take one down and pass it around, 41 bottles of beer on the wall.41 bottles of beer on the wall, 41 bottles of beer.Take one down and pass it around, 40 bottles of beer on the wall.40 bottles of beer on the wall, 40 bottles of beer.Take one down and pass it around, 39 bottles of beer on the wall.39 bottles of beer on the wall, 39 bottles of beer.Take one down and pass it around, 38 bottles of beer on the wall.38 bottles of beer on the wall, 38 bottles of beer.Take one down and pass it around, 37 bottles of beer on the wall.37 bottles of beer on the wall, 37 bottles of beer.Take one down and pass it around, 36 bottles of beer on the wall.36 bottles of beer on the wall, 36 bottles of beer.Take one down and pass it around, 35 bottles of beer on the wall.35 bottles of beer on the wall, 35 bottles of beer.Take one down and pass it around, 34 bottles of beer on the wall.34 bottles of beer on the wall, 34 bottles of beer.Take one down and pass it around, 33 bottles of beer on the wall.33 bottles of beer on the wall, 33 bottles of beer.Take one down and pass it around, 32 bottles of beer on the wall.32 bottles of beer on the wall, 32 bottles of beer.Take one down and pass it around, 31 bottles of beer on the wall.31 bottles of beer on the wall, 31 bottles of beer.Take one down and pass it around, 30 bottles of beer on the wall.30 bottles of beer on the wall, 30 bottles of beer.Take one down and pass it around, 29 bottles of beer on the wall.29 bottles of beer on the wall, 29 bottles of beer.Take one down and pass it around, 28 bottles of beer on the wall.28 bottles of beer on the wall, 28 bottles of beer.Take one down and pass it around, 27 bottles of beer on the wall.27 bottles of beer on the wall, 27 bottles of beer.Take one down and pass it around, 26 bottles of beer on the wall.26 bottles of beer on the wall, 26 bottles of beer.Take one down and pass it around, 25 bottles of beer on the wall.25 bottles of beer on the wall, 25 bottles of beer.Take one down and pass it around, 24 bottles of beer on the wall.24 bottles of beer on the wall, 24 bottles of beer.Take one down and pass it around, 23 bottles of beer on the wall.23 bottles of beer on the wall, 23 bottles of beer.Take one down and pass it around, 22 bottles of beer on the wall.22 bottles of beer on the wall, 22 bottles of beer.Take one down and pass it around, 21 bottles of beer on the wall.21 bottles of beer on the wall, 21 bottles of beer.Take one down and pass it around, 20 bottles of beer on the wall.20 bottles of beer on the wall, 20 bottles of beer.Take one down and pass it around, 19 bottles of beer on the wall.19 bottles of beer on the wall, 19 bottles of beer.Take one down and pass it around, 18 bottles of beer on the wall.18 bottles of beer on the wall, 18 bottles of beer.Take one down and pass it around, 17 bottles of beer on the wall.17 bottles of beer on the wall, 17 bottles of beer.Take one down and pass it around, 16 bottles of beer on the wall.16 bottles of beer on the wall, 16 bottles of beer.Take one down and pass it around, 15 bottles of beer on the wall.15 bottles of beer on the wall, 15 bottles of beer.Take one down and pass it around, 14 bottles of beer on the wall.14 bottles of beer on the wall, 14 bottles of beer.Take one down and pass it around, 13 bottles of beer on the wall.13 bottles of beer on the wall, 13 bottles of beer.Take one down and pass it around, 12 bottles of beer on the wall.12 bottles of beer on the wall, 12 bottles of beer.Take one down and pass it around, 11 bottles of beer on the wall.11 bottles of beer on the wall, 11 bottles of beer.Take one down and pass it around, 10 bottles of beer on the wall.10 bottles of beer on the wall, 10 bottles of beer.Take one down and pass it around, 9 bottles of beer on the wall.9 bottles of beer on the wall, 9 bottles of beer.Take one down and pass it around, 8 bottles of beer on the wall.8 bottles of beer on the wall, 8 bottles of beer.Take one down and pass it around, 7 bottles of beer on the wall.7 bottles of beer on the wall, 7 bottles of beer.Take one down and pass it around, 6 bottles of beer on the wall.6 bottles of beer on the wall, 6 bottles of beer.Take one down and pass it around, 5 bottles of beer on the wall.5 bottles of beer on the wall, 5 bottles of beer.Take one down and pass it around, 4 bottles of beer on the wall.4 bottles of beer on the wall, 4 bottles of beer.Take one down and pass it around, 3 bottles of beer on the wall.3 bottles of beer on the wall, 3 bottles of beer.Take one down and pass it around, 2 bottles of beer on the wall.2 bottles of beer on the wall, 2 bottles of beer.Take one down and pass it around, 1 bottle of beer on the wall.1 bottle of beer on the wall, 1 bottle of beer.Take it down and pass it around, no more bottles of beer on the wall.No more bottles of beer on the wall, no more bottles of beer.Go to the store and buy some more, 99 bottles of beer on the wall.```## For bonus pointsDid you get the tests passing and the code clean? If you want to, theseare some additional things you could try:* Remove as much duplication as you possibly can.* Optimize for readability, even if it means introducing duplication.* If you've removed all the duplication, do you have a lot ofconditionals? Try replacing the conditionals with polymorphism, if itapplies in this language. How readable is it?Then please share your thoughts in a comment on the submission. Did thisexperiment make the code better? Worse? Did you learn anything from it?## Rust InstallationRefer to the [exercism help page][help-page] for Rust installation and learningresources.## Writing the CodeExecute the tests with:```bash$ cargo test```All but the first test have been ignored. After you get the first test topass, open the tests source file which is located in the `tests` directoryand remove the `#[ignore]` flag from the next test and get the tests to passagain. Each separate test is a function with `#[test]` flag above it.Continue, until you pass every test.If you wish to run all ignored tests without editing the tests source file, use:```bash$ cargo test -- --ignored```To run a specific test, for example `some_test`, you can use:```bash$ cargo test some_test```If the specific test is ignored use:```bash$ cargo test some_test -- --ignored```To learn more about Rust tests refer to the [online test documentation][rust-tests]Make sure to read the [Modules][modules] chapter if youhaven't already, it will help you with organizing your files.## Further improvementsAfter you have solved the exercise, please consider using the additional utilities, described in the [installation guide](https://exercism.io/tracks/rust/installation), to further refine your final solution.To format your solution, inside the solution directory use```bashcargo fmt```To see, if your solution contains some common ineffective use cases, inside the solution directory use```bashcargo clippy --all-targets```## Submitting the solutionGenerally you should submit all files in which you implemented your solution (`src/lib.rs` in most cases). If you are using any external crates, please consider submitting the `Cargo.toml` file. This will make the review process faster and clearer.## Feedback, Issues, Pull RequestsThe [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help!If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/main/contributing-to-language-tracks/README.md).[help-page]: https://exercism.io/tracks/rust/learning[modules]: https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html[cargo]: https://doc.rust-lang.org/book/ch14-00-more-about-cargo.html[rust-tests]: https://doc.rust-lang.org/book/ch11-02-running-tests.html## SourceLearn to Program by Chris Pine [http://pine.fm/LearnToProgram/?Chapter=06](http://pine.fm/LearnToProgram/?Chapter=06)## Submitting Incomplete SolutionsIt's possible to submit an incomplete solution so you can see how others have completed the exercise.
[package]edition = "2018"name = "beer-song"version = "0.0.0"
# Generated by Cargo# will have compiled files and executables/target/**/*.rs.bk# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries# More information here http://doc.crates.io/guide.html#cargotoml-vs-cargolockCargo.lock
{"track":"rust","exercise":"beer-song","id":"1821ecf1a1d84763b6f09f2f1697095a","url":"https://exercism.io/my/solutions/1821ecf1a1d84763b6f09f2f1697095a","handle":"nicoty","is_requester":true,"auto_approve":false}
use armstrong_numbers::*;#[test]fn test_zero_is_an_armstrong_number() {assert!(is_armstrong_number(0))}#[test]#[ignore]fn test_single_digit_numbers_are_armstrong_numbers() {assert!(is_armstrong_number(5))}#[test]#[ignore]fn test_there_are_no_2_digit_armstrong_numbers() {assert!(!is_armstrong_number(10))}#[test]#[ignore]fn test_three_digit_armstrong_number() {assert!(is_armstrong_number(153))}#[test]#[ignore]fn test_three_digit_non_armstrong_number() {assert!(!is_armstrong_number(100))}#[test]#[ignore]fn test_four_digit_armstrong_number() {assert!(is_armstrong_number(9474))}#[test]#[ignore]fn test_four_digit_non_armstrong_number() {assert!(!is_armstrong_number(9475))}#[test]#[ignore]fn test_seven_digit_armstrong_number() {assert!(is_armstrong_number(9_926_315))}#[test]#[ignore]fn test_seven_digit_non_armstrong_number() {assert!(!is_armstrong_number(9_926_316))}
pub fn is_armstrong_number(num: u32) -> bool {unimplemented!("true if {} is an armstrong number", num)}
# Armstrong NumbersAn [Armstrong number](https://en.wikipedia.org/wiki/Narcissistic_number) is a number that is the sum of its own digits each raised to the power of the number of digits.For example:- 9 is an Armstrong number, because `9 = 9^1 = 9`- 10 is *not* an Armstrong number, because `10 != 1^2 + 0^2 = 1`- 153 is an Armstrong number, because: `153 = 1^3 + 5^3 + 3^3 = 1 + 125 + 27 = 153`- 154 is *not* an Armstrong number, because: `154 != 1^3 + 5^3 + 4^3 = 1 + 125 + 64 = 190`Write some code to determine whether a number is an Armstrong number.## Rust InstallationRefer to the [exercism help page][help-page] for Rust installation and learningresources.## Writing the CodeExecute the tests with:```bash$ cargo test```All but the first test have been ignored. After you get the first test topass, open the tests source file which is located in the `tests` directoryand remove the `#[ignore]` flag from the next test and get the tests to passagain. Each separate test is a function with `#[test]` flag above it.Continue, until you pass every test.If you wish to run all ignored tests without editing the tests source file, use:```bash$ cargo test -- --ignored```To run a specific test, for example `some_test`, you can use:```bash$ cargo test some_test```If the specific test is ignored use:```bash$ cargo test some_test -- --ignored```To learn more about Rust tests refer to the [online test documentation][rust-tests]Make sure to read the [Modules][modules] chapter if youhaven't already, it will help you with organizing your files.## Further improvementsAfter you have solved the exercise, please consider using the additional utilities, described in the [installation guide](https://exercism.io/tracks/rust/installation), to further refine your final solution.To format your solution, inside the solution directory use```bashcargo fmt```To see, if your solution contains some common ineffective use cases, inside the solution directory use```bashcargo clippy --all-targets```## Submitting the solutionGenerally you should submit all files in which you implemented your solution (`src/lib.rs` in most cases). If you are using any external crates, please consider submitting the `Cargo.toml` file. This will make the review process faster and clearer.## Feedback, Issues, Pull RequestsThe [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help!If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/main/contributing-to-language-tracks/README.md).[help-page]: https://exercism.io/tracks/rust/learning[modules]: https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html[cargo]: https://doc.rust-lang.org/book/ch14-00-more-about-cargo.html[rust-tests]: https://doc.rust-lang.org/book/ch11-02-running-tests.html## SourceWikipedia [https://en.wikipedia.org/wiki/Narcissistic_number](https://en.wikipedia.org/wiki/Narcissistic_number)## Submitting Incomplete SolutionsIt's possible to submit an incomplete solution so you can see how others have completed the exercise.
[package]edition = "2018"name = "armstrong_numbers"version = "1.1.0"
# Generated by Cargo# will have compiled files and executables/target/**/*.rs.bk# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries# More information here http://doc.crates.io/guide.html#cargotoml-vs-cargolockCargo.lock
{"track":"rust","exercise":"armstrong-numbers","id":"65325821982d4243827a1245f404438d","url":"https://exercism.io/my/solutions/65325821982d4243827a1245f404438d","handle":"nicoty","is_requester":true,"auto_approve":false}