ENG  RUS Timus Online Judge
Online Judge
Problems
Authors
Online contests
Site news
Webboard
Problem set
Submit solution
Judge status
Guide
Register
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

## Discussion of Problem 1086. Cryptography

Accepted c#
Posted by RolJan 15 May 2018 18:16
using System;
using System.Collections.Generic;
namespace Timus
{
public class Program
{
static void Main(string[] args)
{
Cryptography_1086 firstSolution = new Cryptography_1086();
firstSolution.CalculatePrimes();
firstSolution.GetNumbersFromInput();
//firstSolution.GetNumbersFromInputForTests(15000);
firstSolution.FindPrimesAndListInConsole();
}

}
public class Cryptography_1086
{
int numbersAmount_k = 0;
const int maxNumberValue = 15001;
public List<int> PrimeNumbersList { get; set; }
public List<int> SearchedPrimeNumbersIndexes { get; set; }

public Cryptography_1086()
{
}

public void CalculatePrimes()
{
}
}
}
public bool IsPrime(int number)
{
if (number % 2 == 0 || number % 3 == 0)
return false;

int i = 5;

while (i * i <= number) {
if (number % i == 0 || number % (i + 2) == 0)
return false;

i += 6;
}
return true;
}

public void GetNumbersFromInput()
{
if (numbersAmount_k > 0) {
int counter = 1;
while (counter <= numbersAmount_k) {

++counter;
}
else {
Console.WriteLine("Please enter valid number, n > 0 && n < " + PrimeNumbersList.Count);
}
}
}
else {
Console.WriteLine("Please enter valid number, k > 0");
GetNumbersFromInput();
}
}

public void GetNumbersFromInputForTests(int numbersAmount_k)
{
int counter = 1;
while (counter <= numbersAmount_k) {

++counter;