Lab 3
(21-1-2002 to 24-1-2002)

1. Define a class RecurringPatterns and define methods in it which will print the following patterns.
    a) The method takes an integer argument n and prints the following pattern, shown for n=4.
           a
          a a
         a a a
        a a a a
         a a a
          a a
           a

    b) The method takes an integer argument and prints the following pattern, shown for n=4.
           1
          121
         12321
        1234321
         12321
          121
           1

    c) The method takes an integer argument and prints the following pattern, shown for n=4.
        abcdcba
        abc cba
        ab   ba
        a     a
        ab   ba
        abc cba
        abcdcba

    Note: for the three methods above you can assume that n<10. However, think about what you would do if you allowed n to be a 2 or even 3 digit integer.

[15]
2.    Twin primes are prime numbers whose difference is 2. For example 3,5; 5,7; 11,13; 17,19 etc. Define a class NumberProblems with a suitable method which takes an integer argument and prints out all the twin primes below that number.
[10]