Divisibility


Divisibility 
We say that a nonzero b divides a if a=qb for some m, where a,b and q are integers.That is b, divides a if there is no remainder on division.The notation ba is commonly used to meanb divides a.Also, if  b|a, we say that b is a divisor of a. If b does not divide a we denote it by ba.

For example, 636  but 736. Note that b0 for any non-zero integer b and 1a for any integer a. When we write ba, it is tacitly assumed that b is a non-zero integer.

We can easily deduce the following properties form the definition of divisibility itself

Let a,b,c,d be any non-zero integers.
1.if a|1 , then a=±1

2. If a|b and b|c  then  a|c.
Proof: (1) Suppose b=na and c=mb, where n;mZ. Then c=m(na)=(mn)a and so a|c.

3. If a|b and c|d then ac|bd.
Proof: (2) Suppose b=na and d=mc where n;mZ. Then bd=(na)(mc)=(mn)(ac), i.e.,
ac|bd.

4.If a|x and a|y then a|cx+dy for any integers c;d.
Proof: x=an;y=am
cx+dy=c(an)+d(am)
a(cn+dm)a|cx+dy

Example: 7|14 and 7|63, Then  7|(214+363)
7|7(27+39)

5.If d|a and a0 then |d||a|

6.if a|b and b|a if and only if a=±b.
a|b|a||b|
b|a|b||a|
|a|=|b|
a=±b

Quotient and Remainder 

If a and n are integers with n>0 , then there is unique pair of integers q and r such that

a=qn+r0r<n

Example:
If a=9 and n=4, then we have 9=24+1 with 01<4, so q=2 and r=1.If a=9 and n=4 then q=3 and r=3

We call q the quotient and r the remainder.By dividing by n, so that

an=q+rnand0rn<1

We see that q is the integer part  a/n of a/n, the greatest integer ia/n. This makes it easy to calculate q, and then to find r=aqn.The remainder is often referred to as a residue.



Python code to find all positive divisors of a number

def find_divisors(n):
    # Initialize an empty list to store divisors
    divisors = []
    
    # Iterate from 1 to the square root of n
    for i in range(1, int(n**0.5) + 1):
        # If i is a divisor of n
        if n % i == 0:
            divisors.append(i)
            # Add the complement divisor if it's different
            if i != n // i:
                divisors.append(n // i)
    
    # Sort the list of divisors
    divisors.sort()
    return divisors

# Example usage
number = 24
print(f"All positive divisors of {number} are: {find_divisors(number)}")

Output
All positive divisors of 24 are: [1, 2, 3, 4, 6, 8, 12, 24]

Quotient and remainder
print("q=",9//4)
print("r=",9%4)
print("q=",-9//4)
print("r=",-9%4)

Output
q= 2
r= 1
q= -3
r= 3

Comments

Popular posts from this blog

Number Theory CST 292 KTU IV Semester Honors Course Notes Dr Binu V P 9847390760

Sum of Squares

Well Ordering Principle