Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. pub fn recursive(pset: &mut PrimeSet, product: u32) {
  2. for i in 0.. {
  3. let p = pset.iter().nth(i).unwrap();
  4. let a = p as u32 * product;
  5. if a > 40 {
  6. return;
  7. } else {
  8. recursive(pset, a);
  9. }
  10. }
  11. }
  12.  
  13. // stubs
  14. pub struct PrimeSet;
  15. pub struct PrimeSetIter<'a>(std::marker::PhantomData<&'a mut ()>);
  16. impl<'a> Iterator for PrimeSetIter<'a> {
  17. type Item = u64;
  18. fn next(&mut self) -> Option<u64> {
  19. Some(2)
  20. }
  21. }
  22.  
  23. impl PrimeSet {
  24. pub fn iter<'a>(&'a mut self) -> PrimeSetIter<'a> {
  25. PrimeSetIter(std::marker::PhantomData)
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement