Tips for using the Prime Triangle Applet

Input Values

​​​​​​​Put the number of rows you want to generate in the "Up to what row?" field.

Put the number of tenths of a second you want to wait between screen updates in the "Display update interval" field. Since updating the display takes some time, the lower the number, the longer it takes to generate the rows. You can change this while the rows are being generated.

Mode Controls

Check "Verify" to run a test on each row after it's generated to make sure it is correct. Note that this slows things down, and, since it uses the isPrime routine, will result in more prime calls being reported than are actually used to generate the rows.

Check "No Output" to just calculate the rows without displaying any data. This is useful if you're trying to see how far things can go, or to test the speed of your computer since the display field is limited on most Applet Viewers and will overflow, not to mention taking a lot of time to update.

Check "Stats instead of rows" if you want to get a tab-delimited list of the stats reported in the monitors. You can copy the list from the text field and paste it into a spreadsheet or the like to analyze.

If you select "One Row at a Time" (the default), when you hit the GO button, the system generates rows up to the number you entered in the "Up to what row?" field and stops. At that point you can click the "Next Row" button to do just one more row, or put a new number in the "Up to what row?" field and click "Keep Going" to go until that row is reached.

If you want to just let it go for a long time, you can put a really big number in the "Up to what row?" field and let 'er rip. If you later change your mind but don't want to abort, you can put a lower number in the "Up to what row?" field. If the "Up to what row?" field is less than the current row number, the program will pause.

The "Complete Triangle" button makes the entire triangle without stopping, and prints it in triangular fashion.

The "One row only" button calculates only one row (taking the row number from "Up to what row?"). Is starts with 1 2 3…n and rearranges as necessary.

Status Monitors

The program monitors certain things and displays them as it runs. For all the "# calls" items, the system is showing a count of how many times that routine was called, both for the row being worked on right now, and the total for this triangle. The isPrime routine is called to check if a number is prime. The rearrange routine is called when a row must be reordered to stay prime. The swap routine is called when numbers need to be moved.

The memory monitor shows the number of free bytes and the total number of bytes available.

The time monitors show the amount of time (wall clock time) spent on the current row and the current triangle.

Use your "Back" button to return!