Tag Archive
The following is a list of all entries tagged with Math:
Swap without Temporary Variable
Filed in Programming, April 30, 2008, 12:47 pmWhen we’re programming, if we want to swap values of two integer values, the “normal” way we do it would look like:
x = 5
y = 3
temp = x
x = y
y = temp
We need a temporary variable as a container to hold a value first then do the swap.
What if in some situation you can’t use [...]
A Math Problem and the Answer
Filed in Discovery, April 27, 2008, 9:38 pmProblem: Two prime numbers (>=5) and there are one and only one number between them, such as (5, 7), (11, 13), (17, 19), etc.. Prove the sum of such two prime numbers can always be divided by 6.
Answer: All the natural numbers can be expressed as 6n+0, 6n+1, 6n+2, 6n+3, 6n+4, 6n+5, n >= 0. [...]