primesDesign - Apo223 15735 Pseudocode User will be asked...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Apo223 15735 Pseudocode: User will be asked for number of primes, n. If this number is greater than L (L = largest prime before hitting short int max number), then set n = L. Call makeArray to initialize array a[n1] or a[L]. makeArray, with parameter n: create array, a[L] with all values equal to 1, except for a[0] and a[1] make a[L] = L create array, b[L] b[0] = 2 { Increment i strike all multiples of 2 (or next prime) from array a (make them 0) make b[i] the next smallest prime (the next a[i] = 1) } do this for n terms. Array is complete, send to main. printArray, with parameter a[n1]: find n&8, make this equal to R. for R times, print primes down (n/8 + 1) times (with \n at each last term), then for 8R times, print primes down for just (n/8) times. Array is printed. findCharacteristic, with parameter a[n1]: for n4 times, find a[n] + a[n+1] + a[n+2] = S. If a[S] = 1, then print a[n] + + a[n+2] = S to the screen with proper formatting. This should result in a nice program. ...
View Full Document

Page1 / 2

primesDesign - Apo223 15735 Pseudocode User will be asked...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online