Created
April 8, 2016 09:48
-
-
Save EugenyB/4e108762558941b2b9e0f8c0a7038f20 to your computer and use it in GitHub Desktop.
e-olymp.com problem's 4739 solution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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