Amazon.com Widgets Boolean Variables section
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 26, 2014, 07:22:03 PM
Home Help Search chat Login Register 
News: Read this please.The Great Kangaroo Escape Looking for reviews of the 4th ed on Amazon!   Twitter:  @skochan
                     

+ Official Forum for Programming in Objective-C (the iPhone Programming Language) - Stephen Kochan
|-+ Old Stuff
| |-+ Chapter Study
| | |-+ Chapter 6 - Making Decisions
| | | |-+ Boolean Variables section
Pages: [1] Go Down
Print
Author Topic: Boolean Variables section (Read 1001 times)
brenavich
Newbie
*
Posts: 1


Email




on: December 05, 2011, 08:03:31 PM

I'm reading the second paragraph under Boolean Variables (P.114) and I'm a little confused. In the following statement:

"If you had the task of generating all prime numbers up to 50, for example, the most straightforward algorithm to generate such a table would simply test each integer, p, for divisibility by all integers from 2 through p-1."

What is p-1? Is it saying --p or p = p-1? Please help!
Logged
skochan
Administrator
Hero Member
*****
Posts: 3114







Reply #1 on: December 05, 2011, 09:26:47 PM

p-1 means "p minus 1".  So if p were 50, then the sentence says you would test the value 50 for even divisibility by the numbers 1 through 50-1 or 49.

Cheers,

Steve
Logged
Pages: [1] Go Up
Print
Jump to:



Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Entire forum contents (c) 2009 classroomM.com. All rights reserved.