Skip to content

Commit

Permalink
readme
Browse files Browse the repository at this point in the history
Signed-off-by: Julio Jimenez <[email protected]>
  • Loading branch information
juliojimenez committed Apr 18, 2024
1 parent a182fee commit 50fd45a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 9 deletions.
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,25 @@
# kaprekar
Finding Kaprekar Constants using a recursive Kaprekar's Routine algorithm (brute force).

Generates Kaprekar constants and series.

## Usage

```bash
Usage: kaprekar [OPTIONS]

Options:
-n, --number <NUMBER> Perform Kaprekar's routine on a number [default: 0]
-s, --start <START> Perform Kaprekar's routine starting from a number [default: 0]
-e, --end <END> Perform Kaprekar's routine up to a number [default: 0]
-a, --all Perform Kaprekar's routine on all numbers
-i, --iterations <ITERATIONS> Number of iterations to perform [default: 20]
-t, --truncate Empty out non-series and non-constant vectors.
-o, --output <OUTPUT> Output the results to a csv file
-c, --cont <CONT> Continue adding results to an existing csv file
-v, --verbose Print the Kaprekar routine
--symlink Create a symlink in /usr/local/bin
-h, --help Print help
-V, --version Print version
```

##
15 changes: 7 additions & 8 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,44 +14,43 @@ use std::path::PathBuf;
#[derive(Parser, Debug)]
#[command(version, about, long_about = None)]
struct Args {
/// Perform Kaprekar's routine on a number.
/// Perform Kaprekar's routine on a number
#[arg(short, long, default_value = "0")]
number: BigUint,

/// Perform Kaprekar's routine starting from a number.
/// Perform Kaprekar's routine starting from a number
#[arg(short, long, default_value = "0")]
start: BigUint,

/// Perform Kaprekar's routine up to a number.
/// Perform Kaprekar's routine up to a number
#[arg(short, long, default_value = "0")]
end: BigUint,

/// Perform Kaprekar's routine on all numbers.
/// Perform Kaprekar's routine on all numbers
#[arg(short, long)]
all: bool,

/// Number of iterations to perform.
#[arg(short, long, default_value = "20")]
iterations: u16,

/// Empty out non-series and non-constant vectors.
/// https://kaprekar.sourceforge.net/output/sample.php
/// Empty out non-series and non-constant vectors
#[arg(short, long, default_value = "false")]
truncate: bool,

/// Output the results to a csv file.
#[arg(short, long)]
output: Option<PathBuf>,

/// Continue adding results to an existing csv file.
/// Continue adding results to an existing csv file
#[arg(short, long)]
cont: Option<PathBuf>,

/// Print the Kaprekar routine.
#[arg(short, long)]
verbose: bool,

/// Create a symlink in /usr/local/bin.
/// Create a symlink in /usr/local/bin
#[arg(long)]
symlink: bool,
}
Expand Down

0 comments on commit 50fd45a

Please sign in to comment.