- Community Home
- :
- Code and Documents
- :
- Code Exchange
- :
- Example Programs
- :
- Calculate Prime Number in LabVIEW

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Document History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Email to a Friend
- Printer Friendly Page
- Report to a Moderator

Calculate Prime Number in LabVIEW

Demonstrates how to calculate 1001st prime number using MathScript Node.

**Description**

This program is to solve Project Euler Problem Number 7: By listing the first six prime numbers, what is the 10001st prime number? The example uses iteration number as the number to be computed. MathScript Node is used to determine whether the number is a prime number. The prime numbers identified is built into an array. The program stops when the prime numbers elements reach 1001. The last prime number will be displayed.

**Requirements**

LabVIEW 2012 (or compatible)

MathScript RT module

**Steps to Implement or Execute Code**

- Run the program
- The program takes a few seconds to compute the first 1001 prime numbers
- The 1001st prime number will be displayed

**Additional Information or Resources**

VI Block Diagram

**This document has been updated to meet the current required format for the NI Code Exchange.**

Rob W.