import 'dart:io';
void main() {
stdout.write("Please give us a number: ");
int chosenNumber = int.parse(stdin.readLineSync());
checkPrime(chosenNumber);
}
void checkPrime(int number) {
// List comprehensions
List<int> a = [
for (var i = 1; i <= number; i++)
if (number % i == 0) i
];
// Check for prime
a.length == 1
? print("The chosen number is a prime")
: print("The chosen number is not a prime");
}
var newArray = List.generate(10000, (index) => index);
List b=[];
void checkPrime(int num){
int i,m=0,flag=0;
m=num~/2;
for(i = 2;i<=m;i++){
if(num%i == 0){
flag=1;
break;
}
}
if(flag==0){
b.add(num);
// print('num $num');
}}
for(int i=1;i<newArray.length; i++){
checkPrime(newArray[i]);
}
print(b);