Skip to content

Instantly share code, notes, and snippets.

@EugenyB
Created April 8, 2016 09:48
Show Gist options
  • Save EugenyB/4e108762558941b2b9e0f8c0a7038f20 to your computer and use it in GitHub Desktop.
Save EugenyB/4e108762558941b2b9e0f8c0a7038f20 to your computer and use it in GitHub Desktop.
e-olymp.com problem's 4739 solution
import java.util.Scanner;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println(IntStream.range(Math.max(in.nextInt(), 2), in.nextInt() + 1)
.filter(t -> IntStream.range(2, (int) Math.sqrt(t) + 1).noneMatch(d -> t % d == 0)).mapToObj(Integer::toString)
.collect(Collectors.joining(" ")));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment