Prime Number Calculations Exercise (PDF)

Document Details

CoherentYtterbium

Uploaded by CoherentYtterbium

IPCA

Nuno Lopes

Tags

prime numbers programming high performance computing algorithm

Summary

This document outlines exercises related to prime number calculations and algorithm development. The exercises involve calculating prime numbers within a given numerical range, including sequential and parallel approaches. Focus is placed on identifying global variables, optimizing code structure through local temporary variables and the significance of using mutual exclusion mechanisms in parallel computing. The exercises are suitable for understanding fundamental programming concepts and optimization techniques for problem-solving in high performance computing.

Full Transcript

Practical Exercise: High Performance Computing Prime Number Nuno Lopes ([email protected]) Calculations Objective u Develop a program that allows to calculate how many prime numbers exist in a range from 1 to N. u Input: N, si...

Practical Exercise: High Performance Computing Prime Number Nuno Lopes ([email protected]) Calculations Objective u Develop a program that allows to calculate how many prime numbers exist in a range from 1 to N. u Input: N, size of the set of numbers to check u Output: number of prime numbers in the interval 1..N u A prime number has "two and only two divisors, itself and the unit". Trivial Function isPrime() int isPrime(long number) { if (number < 2) return 0; for (long i=2; i

Use Quizgecko on...
Browser
Browser