Strings: Level 4 Challenges


Suppose we are given two strings aa and bb. We want to devise a function f(a,b)f(a,b) that tells us how close the two strings are. A reasonable measurement would be to measure how many "edits" operations have to be made to one string in order to change it to the other. There are three possible "edit" operations:

Substitution: Replacing a single character from aa so that it matches bb costs 11. If a=rota=\text{rot} and b=dotb=\text{dot}. Then f(a,b)=1f(a,b)=1.

Insertion: Inserting a single character also costs 11. Ie, If a=girla = \text{girl} and b=girlsb=\text{girls}, then f(a,b)=1f(a,b)=1.

Deletion: Deleting a single character also costs 11. Ie. If a=houra=\text{hour} and b=ourb=\text{our} then f(a,b)=1f(a,b)=1.

Given aa and bb, compute f(a,b)f(a,b).

Let the reverse of a positive integer nn, denoted R(n),R(n), be the result when the digits of the number are written backwards; for example, R(190)=091,R(190) = 091, or just 91.91.

Call a positive integer nn brilliant if n+R(n)n + R(n)

is a multiple of 13. Let BB be the 1000010000th brilliant number. Compute the last three digits of B.B.

A palindromic-prime or PalPrime is a prime number that is also a palindrome.The first few PalPrimes are 2,3,5,7,11,101,131,151,181,191...2, 3, 5, 7, 11, 101, 131, 151, 181, 191.... Let SS be the sum of the digits of the largest PalPrime NN such that N<109N<10^9.What is the value of SS?


Problem Loading...

Note Loading...

Set Loading...