Consider the sequence of natural numbers

1, 2, 3, 4, 5, 6, 7......

Removing every second number produces the sequence

1, 3, 5, 7, 9, 11, 13, 15, 17, ..........

Removing every third number produces the sequence

1, 3, 7, 9, 13, 15, 19, 21, 25, 27, .........

This process continues indefinitely by removing fourth, fifth .... and so on, till after a fixed number of steps certain numbers remains indefinitely. These are known as lucky numbers.

Write a program to generate and print lucky numbers less then then a given natural number N where N<=50.

### Have something to say? Log in to comment on this post.

0 comments