### 18 – Classes, Objects, & Inheritance

Welcome to the masterclass on Object Oriented Programming (Classes, Objects, & Inheritance). As this topic requires some practice, please use the video above as an introduction and make use of the Easter break to try out the programming challenges below.

## Challenge 1

For every positive number we define the function as the smallest positive integer such that is not divisible by .
E.g:
13 is divisible by 1
14 is divisible by 2
15 is divisible by 3
16 is divisible by 4
17 is NOT divisible by 5
So .
Similarly:
120 is divisible by 1
121 is NOT divisible by 2
So .

Define to be the number of integers , , for which .
So and .

Find the sum, as ranges from 1 to 31, of .

## Challenge 2

A non-decreasing sequence of integers can be generated from any positive real value by the following procedure: begin{align} begin{split} b_1 &= theta b_n &= leftlfloor b_{n-1} rightrfloor left(b_{n-1} â€“ leftlfloor b_{n-1} rightrfloor + 1right)~~~forall ~ n geq 2 a_n &= leftlfloor b_{n} rightrfloor end{split} end{align} Where is the floor function.

For example, generates the Fibonacci sequence:

The concatenation of a sequence of positive integers is a real value denoted constructed by concatenating the elements of the sequence after the decimal point, starting at :

For example, the Fibonacci sequence constructed from yields the concatenation Clearly, for this value of .

Find the only value of for which the generated sequence starts at and the concatenation of the generated sequence equals the original value: . Give your answer rounded to 24 places after the decimal point.

## Extension Challenges

HackerRank holds a number of online programming challenges across a number of languages. Use the links below to try out the Object Oriented Python challenges (or use the site to find your chosen programming language)

Challenge 1 â€“ Find the Torsional Angle

Challenge 2 â€“ Dealing With Complex Numbers

Challenges reproduced with thanks to https://projecteuler.net