SPOJ: TDPRIMES – Printing some primes

Problem Link http://www.spoj.com/problems/TDPRIMES/ Problem Description In this problem,we need to print 1st,101st,201st…….primes less than 10^8. Concepts Used This problem is based on prime sieve(Sieve of Eratosthenes).. Code #include<stdio.h> #include<vector> /*To check whether a number i is prime or not,we need to check a[i/2] or a[i>>1] whether it is true or false*/ #define isprime(i) (a[i>>1]) /*number […]

Continue reading


SPOJ: CPRIME – Prime Number Theorem

Problem Link http://www.spoj.com/problems/CPRIME/ Problem Description In this problem,we need to find percentage error for prime number theorem ((pi(x)-lnx)/pi(x)) % where pi(x) =number of primes not greater than x. Concepts Used This problem is based on prime sieve(Sieve of Eratosthenes).. Code #include<stdio.h> #include<vector> #include<math.h> /*To check whether a number i is prime or not,we need to […]

Continue reading


SPOJ: TDKPRIME – Finding the Kth Prime

Problem Link http://www.spoj.com/problems/TDKPRIME/ Problem Description In this problem, We need to print the value of kth prime(max value of k is 5000000) for a number of test cases. Concepts Used This problem is based on prime sieve(Sieve of Eratosthenes). Code #include<stdio.h> #include<vector> /*To check whether a number i is prime or not,we need to check […]

Continue reading


SPOJ: PRIME1 – Prime Generator

Problem Link http://www.spoj.com/problems/PRIME1/ Problem Description In this problem, We need to print all the prime numbers between two given values m and n. Concepts Used This problem is based on prime sieve(Sieve of Eratosthenes). Code #include<stdio.h> void sieve(long long int,long long int,bool[],bool[]); int main() { long long int m,n; int t; /*scan number of test […]

Continue reading


How to Create Triggers in phpMyAdmin

In this tutorial I will show you how to create MySQL triggers in phpMyAdmin. Creating Triggers in MySQL In order to create a trigger in MySQL we can follow the recommendations that we can found in http://dev.mysql.com/doc/refman/5.5/en/create-trigger.html. There, they explain us perfectly how we should create our trigger and they even provide some examples. Here’s […]

Continue reading