Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prime factorization example #17

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Prime factorization example #17

wants to merge 3 commits into from

Conversation

morganthomas
Copy link
Member

No description provided.

}
}

pub fn check_prime_factorization(x: u32, ys: Vec<u32>) -> bool {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: &[u32] or impl AsRef<[u32]> is more idiomatic.

Comment on lines +1 to +4
# Fibonacci: A template project for Valida

This is a simple program that calculates the n-th fibonacci number and proves the execution of the computation in Valida. You can use this as a template for your projects which create Valida proofs of execution of Rust code.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is out of date

Comment on lines +13 to +17
let mut z = 1;
for y in ys {
z *= y;
}
z == x
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just a factorization check, we are not checking if each y is prime.

@@ -0,0 +1,201 @@
Apache License
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need another license for each crate? There's one in the main directory.


pub fn main() {
valida_rs::io::println("Please enter a 32-bit number:");
// Read a line from stdin and parse it as an u8.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

u32 instead of u8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants