Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ☐ Perfect Integers @created(18-01-31 18:21) @due(18-02-01 18:32)
- a positive integer (n > 0) that is equal to the sum of it's proper divisors
- divisors of 6 /= 1,2,3
- 6 is Perfect Int because 1 + 2 + 3 == 6
- 1.) gather the user #
- 2.) Check whether # is perfect integer or not
- a.) If so, tell that it is. Probably show the integers used to determine that it is a perfect integer
- b.) If not, tell that it is not. Probably show the integers used to determine that it is not a perfect integer
- How to decide that it is a perf. integer
- while i is less than n (this will run until i >= n is true)
- if n modulo i equals 0 then
- sum += i
- else
- discard
- if sum is equal to n
- n is perfect number
- else
- n is not perfect number
- ☐ Find Slope + Intercept of line when given two points @created(18-01-31 18:21) @due(18-02-01 18:32)
- Pretty simple
- 1.) gather the user's two points (±x1,±y1) -- (±x2,±y2)
- 2.) equation for slope is (y2 - y1)/(x2-x1)
- 3.) finding the y intercept (the 'b' in y=mx+b) is simple
- a.) the slope is m in y=mx+b
- b.) solve for b, so b = -(mx) + y
- c.) for x,y take xn, yn where n is one of the two points
- d.) solve for b
- EXAMPLE (Done in SpeedCrunch)
- x1
- = 23
- y1
- = −7
- x2
- = 2
- y2
- = 9
- m = (y2−y1)/(x2−x1)
- = −0.76190476190476190476
- b = −(m×x1) + y1
- = 10.52380952380952380952
- b = −(m×x2) + y2
- = 10.52380952380952380952
Add Comment
Please, Sign In to add comment