Skip to content

Latest commit

 

History

History
30 lines (24 loc) · 960 Bytes

Palindromic Numbers.md

File metadata and controls

30 lines (24 loc) · 960 Bytes
title difficulty tags source
Palindromic Numbers
2
algorithm
good first mission
label href
British Informatics Olympiad

A palindromic number is one that is the same when its digits are reversed.

For example:

  • 98789 is a palindrome;
  • 12344321 is a palindrome;
  • 12345 is not a palindrome as it becomes 54321 when reversed.

Except for 0, a palindromic number’s leftmost digit must be non-zero.

Write a program that reads in a positive integer of up to 20 digits. You should output the smallest palindromic number that is higher than the input.

Aditional Missions

What is the largest difference between a palindromic number (of up to 20 digits) and the next highest palindromic number?

How many integers are there, between 1 and 99999 inclusive, that are not the sum of two palindromic numbers?