Find five prime factors of $3^{140 }- 1$ I tried to simplify $3^{140}$ but I couldn't go past $81^{35}$, any help would be greatly appreciated.
$$3^{140}-1=(3^{70}+1)(3^{70}-1)=(3^{70}+1)(3^{35}+1)(3^{35}-1)$$
and from $a-b\mid a^7-b^7$, the number
$ 3^{35}\pm1$ is a multiple of $3^5\pm1$. These are of feasible size and give us $2, 11, 61$ as prime factors. Also, $3^{35}\pm1$ is a multiple of $3^7\pm1$, which are still of manageable size and give us $547$ and $1093$.

Alternatively, note that $3^{p-1}\equiv 1\pmod p$ for $p\ne 3$, hence looking for small primes with $p-1\mid 140$ is helpful. This way you find $p=2, 5, 11, 29, 71$ very easily.
python 3


print()
print("find the prime factors of an integer")
another = "y"
while another == "y":
    print

    a = (3**140-1)
    b = a
    c = 2
    primes = []
    while b > 1:
        if b % c == 0:
            x  = 0
            while b % c == 0:
                b = b / c
                x = x + 1
            print("    ", c, " is a prime factor of ", a, " ",  x, " times")
            primes.append(c)           
        c = c + 1
    print("     the prime factors of     ", a, "   are ", primes)
    print( "     the largest prime factor of ", a, "  is ", max(primes))
    print()
    another = input("another integer?  y or n   ")

print()
print ("program ended")


output


find the prime factors of an integer
     2  is a prime factor of  6265787482177970379256224194341930332206694446810665274859598050800   171  times
     3  is a prime factor of  6265787482177970379256224194341930332206694446810665274859598050800   1  times
     53  is a prime factor of  6265787482177970379256224194341930332206694446810665274859598050800   1  times
     97  is a prime factor of  6265787482177970379256224194341930332206694446810665274859598050800   1  times
     8867  is a prime factor of  6265787482177970379256224194341930332206694446810665274859598050800   1  times
     15307379  is a prime factor of  6265787482177970379256224194341930332206694446810665274859598050800   1  times
     the prime factors of      6265787482177970379256224194341930332206694446810665274859598050800    are  [2, 3, 53, 97, 8867, 15307379]
     the largest prime factor of  6265787482177970379256224194341930332206694446810665274859598050800   is  15307379

another integer?  y or n