Give a recursive definition for the set of positive integers

Give a recursive definition for the set of positive integers that are not divisible by 3.

Please type.

Solution

Not divisible by 3:

nd3_1 = 1
nd3_(n+1) = nd3_n + increment(nd3_n)

increment = 1 if remainder mod 5 is 1 or 2
This can be achieved with
increment(n) = 1 + floor [ (mod(n,3) + 6) / 10 ]

mod(n,3) = remainder after division by 3
floor = next integer down

increment(1, or 2) = 1 + floor [ (7,8, or 9) / 10 ] = 1 + 0 = 1

Give a recursive definition for the set of positive integers that are not divisible by 3. Please type.SolutionNot divisible by 3: nd3_1 = 1 nd3_(n+1) = nd3_n +

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site