Library · Between the Challenge and the Olympiad · Chapter 3
Digits, Bases and Representation
On this page
- Problems
- Solutions
- Solution: IOQM 2024, Q3
- Solution: IOQM 2026, Q4
- Solution: PRMO 2014, Q2
- Solution: PRMO 2015 Part A, Q6
- Solution: PRMO 2015 Part A, Q7
- Solution: PRMO 2018, Q3
- Solution: PRMO 2018, Q4
- Solution: PRMO 2019, Q6
- Solution: IOQM 2020, Q2
- Solution: IOQM 2024, Q8
- Solution: IOQM 2025 Part SEP, Q7
- Solution: IOQM 2026, Q9
- Solution: IOQM 2026, Q14
- Solution: PRMO 2013, Q6
- Solution: PRMO 2013, Q20
- Solution: PRMO 2015 Part A, Q20
- Solution: PRMO 2017, Q1
- Solution: PRMO 2018, Q20
- Solution: IOQM 2020, Q8
- Solution: IOQM 2021 Part A, Q4
- Solution: IOQM 2024, Q21
- Solution: IOQM 2025 Part SEP, Q28
- Solution: IOQM 2026, Q20
- Solution: PRMO 2018, Q19
- Solution: PRMO 2018, Q30
- Solution: IOQM 2023, Q19
- Solution: IOQM 2023, Q26
Problems
Problem 1
The number obtained by taking the last two digits of in the same order is:
Problem 2
All six digits of three -digit numbers are different. If is the largest possible sum of three such numbers, what is the sum of digits of ?
Problem 3
The first term of a sequence is . Each succeeding term is the sum of the cubes of the digits of the previous term. What is the term of the sequence?
Problem 4
Let denote the sum of the even digits of . For example, . What is the value of ?
Problem 5
How many two-digit positive integers have the property that the sum of and the number obtained by reversing the order of the digits of is a perfect square?
Problem 6
Consider all 6-digit numbers of the form where is odd. Determine the number of all such 6-digit numbers that are divisible by .
Problem 7
The equation is valid in some base (that is, are digits in base in the above equation). Find the sum of all possible values of satisfying the equation.
Problem 8
Let be a three digit number with nonzero digits such that . What is the largest possible prime factor of ?
Problem 9
A number in base 10, is in base and in base . What is the product of the digits of ?
Problem 10
Let be the smallest integer such that the sum of digits of is divisible by as well as the sum of digits of is divisible by . What are the first two digits of in the same order?
Problem 11
How many 3-digit numbers in base 10 are there with and ?
Problem 12
Let be the smallest positive integer whose digits add up to . What is the leading digit of ?
Problem 13
Let be a -digit number with distinct nonzero digits and be the number obtained by reversing the digits of . Determine the largest possible prime factor of .
Problem 14
Let denote the sum of the digits of a positive integer written in base 10. Let be the smallest positive integer such that . What is the value of ?
Problem 15
What is the sum (in base 10) of all the natural numbers less than 64 which have exactly three ones in their base 2 representation?
Problem 16
The digits of a positive integer are four consecutive integers in decreasing order when read from left to right. What is the sum of the possible remainders when is divided by 37?
Problem 17
How many positive integers less than 1000 have the property that the sum of the digits of each such number is divisible by 7 and the number itself is divisible by 3?
Problem 18
Determine the sum of all possible positive integers , the product of whose digits equals .
Problem 19
A 5-digit number (in base 10) has digits , , , , in that order, from left to right. If this number is for some natural number , find the sum of the digits of .
Problem 20
Consider the set of all 6-digit numbers consisting of only 3 digits, , where are distinct. Suppose the sum of all these numbers is . What is the largest remainder when the three digit number is divided by ?
Problem 21
An integer is such that is a three digit number with equal digits, and is a digit number with the digits in some order. What is the remainder when is divided by ?
Problem 22
Let be the coefficient of in the expansion of What is the remainder when is divided by 100?
Problem 23
Let be a positive integer satisfying the equation where and represent different digits and is a six digit number. What is the value of ?
Problem 24
Consider five-digit positive integers of the form that are divisible by the two digit number but not divisible by 13. What is the largest possible sum of the digits of such a number?
Problem 25
Let be the smallest positive integer with the following two properties:
(a) The leading digit of is equal to .
(b) If is the number obtained by moving this leading to the units place, and shifting all the other digits one place to the left, then .
What is the sum of the digits of ?
Problem 26
Let , where there are hundred 6’s in the last term in the sum. How many times does the digit occur in the number ?
Problem 27
Let be a polynomial in which is a non-negative integer for each . If and , what is the value of ?
Problem 28
For , let denote the product of the digits in and denote the sum of the digits in . Consider the set Find the maximum possible number of digits of the numbers in .
Problem 29
In the land of Binary, the unit of currency is called Ben and currency notes are available in denominations Bens. The rules of the Government of Binary stipulate that one can not use more than two notes of any one denomination in any transaction. For example, one can give a change for 2 Bens in two ways: 2 one Ben notes or 1 two Ben note. For 5 Ben one can give 1 one Ben note and 1 four Ben note or 1 one Ben note and 2 two Ben notes. Using 5 one Ben notes or 3 one Ben notes and 1 two Ben notes for a 5 Ben transaction is prohibited. Find the number of ways in which one can give change for 100 Bens, following the rules of the Government.
Problem 30
How many four digit numbers , with non-zero digits in base 10, are there such that and ?
Solutions
Solution: IOQM 2024, Q3
Once a power of has two digits it ends in , and multiplying by again leaves those two digits unchanged.
Look at the pattern: , , , all ending in . One line of algebra shows why. If a number ends in , write it as ; multiplying by gives , which again ends in .
Since ends in , so does every higher power, and in particular . The last two digits are .
Answer 25
Solution: IOQM 2026, Q4
A tens digit counts ten times and a units digit once, so the three largest digits belong in the tens places.
If the numbers have tens digits and units digits , their sum is Suppose some units digit were larger than some tens digit . Swapping the two raises the sum by , so that choice was not the largest. In the best choice every tens digit beats every units digit: the tens digits are and the units digits are .
That gives for instance as , and the sum of the digits of is .
Answer 12
Solution: PRMO 2014, Q2
Compute a few terms and look for a value whose digit-cube sum returns the same value; once that happens, the sequence stops changing.
Apply the rule twice: So the third term is . Now apply it once more: The sequence has reached a fixed point and stays there. Since the th term is far beyond the third,
The three-digit numbers equal to the sum of the cubes of their digits are exactly , , and , and is a fixed point too. A sequence of this kind always falls into one of those or into a short cycle. It is worth knowing that the descent is quick: any four-digit number maps to at most , so the sequence is trapped in a small range almost immediately.
Answer 370
Solution: PRMO 2015 Part A, Q6
Counting by digit position rather than by number turns the whole sum into two identical tallies, because each digit slot runs over through equally often.
The number contributes nothing, since its only non-zero digit is odd, so the sum is really over through . It is convenient to pad these to two digits and include as well, writing every number from to . The extra entry contributes nothing either, and now the list is completely regular: the units digit runs through exactly ten times, and so does the tens digit.
The even digits are , whose sum is . Each digit position therefore contributes to the total, and there are two positions, so
The move that made this easy was refusing to walk through the numbers one at a time. Whenever a question sums a digit-based function over a full block like to , padding to a fixed width and counting one column at a time is almost always the shorter road.
Answer 400
Solution: PRMO 2015 Part A, Q7
A two-digit number and its reversal always add to , so being a perfect square forces to divide , and the digit sum has only one chance to manage it.
Write with from to and from to . The reversed number is , and For this to be a perfect square, the prime must appear to an even power, so must divide . Since is at most and is positive, the only possibility is , which indeed gives .
It remains to count the two-digit numbers whose digits sum to . Choosing determines , and we need to be a digit, so , that is . Every from to works, giving , which is numbers.
Answer 8
Solution: PRMO 2018, Q3
Modulo the palindrome collapses to , because is a multiple of , so the condition is and the odd digit never matters.
Write the number out by place value: Reduce each coefficient modulo . Since , we get ; since exactly, the middle coefficient vanishes; and since , we get . So
Divisibility by therefore means , and is free to be any of the five odd digits.
Count the pairs with from to , from to and . For a given the admissible are those in congruent to , and there are two of them when , or and one otherwise: That is pairs. Multiplying by the choices of the odd digit ,
Answer 70
Solution: PRMO 2018, Q4
Reading both sides in base turns the statement into a cubic in , and is a root whose cofactor has no real zeros at all.
In base the two factors are and , and the product is . Multiplying out the left-hand side, Setting the two equal and collecting terms,
Only three bases need testing. The digits appearing are , , , , and , so ; and rearranging the cubic as shows that a whole number must divide . The divisors of that are at least are , and .
Try : , so is a root. Dividing it out, and the quadratic factor has discriminant , so it has no real root at all. The only base is , which is at least and larger than every digit used, so the sum of all possible values is .
Answer 12
Solution: PRMO 2019, Q6
A Pythagorean triple with all three entries single non-zero digits can only be , so there are just two numbers to factorise.
We need digits from to with . There is no need to know anything about Pythagorean triples: the only squares in play are and ask which is the sum of two others. The following table tests ; checking makes each unordered pair appear once: The only square in the right-hand column is , in the row , with . Equal positive legs cannot work, since would have an odd exponent of on the left and an even one on the right. Thus the only possibilities are and . So is or . Factorising, The largest prime factor appearing is .
Answer 29
Solution: IOQM 2020, Q2
Two readings of the same number in two different bases give two expressions in base ten, and setting them equal produces a quadratic that happens to factor.
The whole difficulty of a problem like this is remembering what a string of digits actually means. Writing in base is shorthand for , and writing in base is shorthand for . Both expressions describe the same number , so we may set them against each other:
Collecting terms leaves , and dividing through by gives , which factors cleanly as . Only one of these roots can be a base, since a base must be positive and must also exceed every digit written in it, and the digit appears. That settles .
From there the arithmetic is short. We have , and as a final check it is worth confirming that really is in base nine, which it is, since . The product of the digits of is therefore .
Answer 64
Solution: IOQM 2024, Q8
Adding changes the digit sum by where is the number of trailing nines, so ; the smallest candidate therefore ends in exactly four nines.
The printed word “integer” leaves the domain implicit. We use the intended reading that is positive. If digit sums of negative integers were defined by ignoring their minus signs, there would be no smallest : every positive solution would give a negative one via , and the positive constructions below continue without bound.
The carry can be seen in : two nines disappear and the preceding digit increases by one, so the digit sum changes by . Now suppose ends in exactly nines. Adding turns those nines into zeros and increases the preceding digit by , so Both digit sums are to be multiples of , so , that is , which gives . In particular is impossible, and the smallest allowed value is .
So ends in four nines: write with and the last digit of not equal to . Then and requiring gives . This already rules out , which would give with digit sum , not a multiple of . We want the smallest such , hence the smallest such , and the digit sums of are , so is the first that works.
Therefore , and a check confirms it: and , both divisible by . The first two digits are and .
Answer 49
Solution: IOQM 2025 Part SEP, Q7
The digit is determined by and , so the count is the number of pairs with and .
Once and are chosen, is forced, and the only requirement is that really is a digit, that is . Also because the number has three digits.
For each from to the digit may be anything from to , which is choices. Summing,
Answer 45
Solution: IOQM 2026, Q9
The smallest number has as few digits as possible and then the smallest leading digit it can, which leaves a single followed by nines, and adding carries through every nine.
A number with digits has digit sum at most . Since , a number with digits reaches at most , so has at least digits, and a -digit number is smaller than any longer one.
Among the -digit numbers with digit sum , the smallest is the one with the smallest leading digit. The other digits add up to at most , so the leading digit is at least , and it equals only when the other digits are all . So and the leading digit of is .
Answer 2
Solution: IOQM 2026, Q14
Reversing the digits leaves the middle digit where it was, so is times the gap between the outer digits, and that gap is too small to bring in a prime larger than .
Write , so that . Then The digits are distinct and non-zero, so is one of , whose prime factors are among , , and . Every is therefore times a number whose prime factors are at most , and the largest prime factor is , for instance .
Answer 11
Solution: PRMO 2013, Q6
The smallest number with a given digit sum is nines with a smaller leading digit, and multiplying that by and adding causes almost no carrying.
To make a number small you want few digits, so you want every digit as large as possible. With digit sum , that means nines and a leading : Nothing with digits or fewer can reach a digit sum of , since , and with digits the leading digit is at least . Equality forces all the remaining digits to be , so this really is the smallest.
Now compute, using the closed form: The first term is followed by zeros, and adding only fills in the last four of those zeros, with no carrying at all. So the digits are , , then a long run of zeros, then , , , , and
Answer 18
Solution: PRMO 2013, Q20
Count by bit position: each of the six positions is set in of the twenty numbers.
A bit is a binary digit, or . For example, represents and has three ones; leading zeros let every number below use six positions. A natural number below is therefore a six-bit string, and we want those with exactly three ones, of which there are .
Rather than list them, count each bit’s contribution. A given position is a one in exactly those strings whose other two ones are chosen from the remaining five positions, that is of them. So each position contributes its place value ten times, and the total is
The same argument gives the sum for any number of ones: with ones among bits the total is .
Answer 630
Solution: PRMO 2015 Part A, Q20
Every such number is for a digit , and leaves remainder on division by , so the seven remainders are seven consecutive integers.
Let the digits be read from the left, where and , so runs from to and there are seven such numbers. Their values are
Both constants behave well modulo . Since , we have , and since , we have . Therefore As runs from to the right-hand side runs from to , all of which are already between and , so they are the remainders themselves and they are seven distinct values. Their sum is
The reason appears rather than some other modulus is that divides , and therefore divides , which is what makes leave the convenient remainder . A problem that pairs repdigit-like numbers with the modulus is nearly always leaning on that fact.
Answer 217
Solution: PRMO 2017, Q1
Divisibility by is itself a statement about the digit sum, so the two conditions collapse into one: the digit sum is a multiple of , and only itself is small enough.
A number is divisible by exactly when its digit sum is, so the two conditions together say that the digit sum is divisible by both and , that is by .
A number below has at most three digits, so its digit sum is at most . The only positive multiple of available is itself, and the digit sum is positive because the number is.
So we must count the numbers below whose digits sum to . Write every such number with three digits, padding with leading zeros, which changes nothing: a number with fewer digits has digit sum at most , so none is lost. We need Replace each digit by its complement, and so on. Then with each , and the upper bound of is automatic since the total is only . Counting those is the standard stars and bars: lay out six stars in a row and choose two of the eight positions in the resulting line of stars and bars to be the bars, which cuts the six into three groups. So the number of solutions is
Answer 28
Solution: PRMO 2018, Q20
The product of the digits of lies between and , and the two inequalities that follow leave room for exactly one integer.
For a one-digit example, the product of the digits of is ; for it is . The leading digit has its full place value in the number, while the digit product only multiplies it by the smaller remaining digits. This suggests bounding the product by the number itself.
Write for the product of the digits. Two facts bound it. It is at least , and it is at most : for a one-digit number the two are equal, and for a number with more digits the leading digit alone contributes at least times itself while the product of the rest is at most , so .
Applying both to : Each quadratic changes sign once in the range of interest, so integer tests settle both without a square root. The first is at and at , so ; the second is at and at , so . So is the only candidate, and it works: and .
The sum of all such is therefore .
Answer 17
Solution: IOQM 2020, Q8
One of the five digits is , and a digit can never exceed , so there are only three numbers in the world to test.
Problems that describe a number through its digits are usually solved by asking what the digits are permitted to be, rather than by any clever algebra. Here the five digits are , , , and , and each of them must be a single digit lying between and , while the leading digit must also be non-zero because the number has five digits.
The binding restriction is the fourth digit. Requiring forces , and combined with this leaves only three candidates, which we may write out in full:
Testing each is now a matter of locating it between neighbouring squares. Since and , the first candidate is not a square. Since and , neither is the second. The third is a square exactly, because .
So , and the sum of its digits is .
Answer 15
Solution: IOQM 2021 Part A, Q4
By symmetry each of the three digits occupies each of the six places equally often, so the enormous sum factors as and reveals only the digit sum.
First rule out a zero among the three digits, since a zero cannot lead and the counting below would not be symmetric. If the digits are , , , then the leading place must carry or , and there are numbers. Each of and heads of them, while in each of the five lower places every one of the three digits appears times. The total is therefore Since and are distinct non-zero digits, , and the total is at most . That falls short of , so none of the digits is zero.
With all three digits non-zero, there are six-digit numbers built from , and . Fix one place, say the leading one. Of those , exactly a third have there, a third have and a third have , so each digit appears times in that place, and by symmetry the same is true of every place.
Summing over all six places, each of which is worth its place value, gives which is . Setting this equal to and dividing, . Notice how little the huge number actually told us: only the digit sum, and nothing about which digit is which.
That leaves an optimisation. We want the largest remainder of the three-digit number on division by , which is just the two-digit ending , so we want as large as possible subject to being distinct digits summing to with . Taking and gives , and all three are distinct, so is attainable. Nothing larger is possible, since would repeat a digit.
Answer 98
Solution: IOQM 2024, Q21
The second condition forces to be around to , and the first caps below ; between them only the repeated digit survives, and that leaves a range of nine integers to test.
If is the three-digit repeated-digit number , then so .
The second condition says is a rearrangement of the digits , and every such four-digit number is at least . Hence
Combining, , and the only repeated-digit multiple in range is , giving For those values runs from to , so is , or . Only uses the digits .
Finally, means , that is . Intersecting with the earlier range leaves the single value and the remainder on division by is .
Answer 91
Solution: IOQM 2025 Part SEP, Q28
The exponents available are the distinct powers of two, so the binary expansion of says exactly which brackets give , and the rest give their constants.
In the first three brackets, a term must take from the first and from the third, because ; the middle bracket contributes its constant . The same binary choice controls the much larger exponent in the question.
Each bracket contributes either its power of or its constant. The powers on offer are , that is for , and the constant in the bracket with is .
Choosing a set of brackets to supply their power of produces the exponent , and by the uniqueness of binary representation there is exactly one giving . Writing it out, so and the brackets left over are those with .
Their constants are , and , so and the remainder on division by is .
Answer 35
Solution: IOQM 2025 Part SEP, Q28
and , so the product of three consecutive odd numbers is pinned down to a narrow range and is the only candidate that works.
By place value, So the equation reads Since divides the left side but not , the two-digit number is a multiple of .
Now bound exactly. At the left side is , still five digits, and at it is . At the other end gives , while gives , which has seven digits. The left side increases with , so
Rather than test fifteen values, use the factor : it must divide one of the three consecutive odd numbers, and the only multiple of between and is itself. So one of equals , and the three possibilities are Multiplying by gives , and , and only the middle one has the required form, with and .
That case is , so , and
Answer 24
Solution: IOQM 2025 Part SEP, Q7
Writing , the number is , so divisibility by says , and makes the condition about say only that .
Expanding by place value, where .
Two conditions follow. Since divides , divisibility of the number by says exactly And since , the number is congruent to , so it fails to be divisible by exactly when , that is when .
We want to maximise the digit sum , where is the digit sum of . For each value of from to , take the two-digit divisor of whose own digit sum is largest. The candidate divisors and their best digit sums can be checked row by row: Every value of is there, so nothing is left to check. The winner is with , giving the number .
Both conditions check out: , and . Its digit sum is .
Answer 33
Solution: IOQM 2026, Q20
Moving the from the front to the back turns into , and the condition becomes . So the question is the first power of that leaves remainder on division by .
Say has digits, and write , where is the number formed by the other digits. Moving the to the end gives , and reads
So must leave remainder on division by . Each remainder is times the one before, reduced: The first success is , with , so
The five digits after the are , so the rearranged six-digit string is , representing the number . The condition holds all the same, and there is no way round it: is less than , so the second digit of is for every that works. The sum of the digits of is .
Answer 27
Solution: PRMO 2018, Q19
is , and times the number is , so is that number minus .
The first few partial sums are , , , and . They suggest a repeating block near the front, so a closed form is useful for exposing the digits of the hundred-term sum.
A closed form
Each term is , so which tidies up to .
The digits
Let be the number written as thirty-three copies of the block followed by a final , so has digits. Summing the geometric series inside it, Multiplying by and using , Therefore and since ,
The subtraction touches only the last four digits. ends in , and , so a hundred digits in all.
Counting the sevens
Each of the blocks contributes one , and the tail contributes one more:
Answer 33
Solution: PRMO 2018, Q30
Non-negative coefficients summing to are all at most , so is nothing but the base-five expansion of .
Since the coefficients are non-negative integers and , every coefficient is at most . That is precisely the condition for the digits of a base-five numeral, and says that the coefficients are the base-five digits of .
Expand in base five: , so As a check, the digits do sum to , as they must, and base-five expansions are unique, so this is the only such polynomial.
Hence
Answer 34
Solution: IOQM 2023, Q19
A squarefree product forbids the digits , and and forbids repeating any prime, so ; the digits are then almost all ones, and their count is fixed by making the largest proper divisor of .
The digits of have product and sum . Prefixing a gives , with the same product and sum . Ones therefore add length without changing the product, which is the resource to exploit.
Since , no digit is . Since is squarefree, no prime may occur twice in the product of the digits. That rules out the digits , and outright, and it also means that among the remaining digits we may use each prime once only. In particular with equality when the non-unit digits are (or , since ).
Digits equal to change nothing in the product and add each to the sum, so they are the way to make a number long. Suppose the non-unit digits have product and sum , and there are ones. Then and the requirement is that is a proper divisor of . The number of digits is , so for a fixed set of non-unit digits we want as large as possible, that is as large as possible, and the largest proper divisor available is divided by its smallest prime factor.
Take with non-unit digits , so and there are four of them. The largest proper divisor of is , so and the number has digits. The number consisting of ones followed by has digit sum , digit product , and is indeed a proper divisor of .
Every other choice is shorter. At the only other grouping of the digits is , which raises to and drops to three non-unit digits, giving .
Every smaller falls far short, and a single bound covers all of them at once. The admissible products are the divisors of , so means . Write , a proper divisor of , so that . If there are non-unit digits with sum , then , since each such digit is at least , and the number of digits is That is nowhere near , so the maximum is .
Answer 92
Solution: IOQM 2023, Q26
Splitting on whether the number of one-Ben notes is , or turns the count into the recursion , , and unwinds in a few lines.
Let be the number of ways to pay Bens using notes of value with at most two of each. Look at how many one-Ben notes are used. That number has the same parity as and is at most , so it is forced up to one choice:
If is odd, exactly one one-Ben note is used, and the rest, , is paid in notes of value at least ; halving every note turns this into a payment of under the same rules. If is even, either no one-Ben note is used, giving a payment of after halving, or two are used, giving . Hence with and .
A check against the problem’s own examples: and , both as stated.
Now unwind , keeping only what is needed: Working back up: , , , , , , and finally
Answer 19
Solution: IOQM 2025 Part SEP, Q28
Subtracting one from every digit turns the two conditions into , and a sum of two non-negative products equal to has only three splits.
Adding the two conditions compares with . Subtracting the matching linear terms makes and , each one short of a product of non-negative integers. Complete those products by adding to each: Adding, everything cancels except the constants:
Every digit is at least , so both products are non-negative integers, and there are exactly three ways to split .
The split
Then forces , and likewise . Both conditions hold, since . This is the single number .
The split
Then one of is , and makes . So , and gives the other of as . The remaining condition reads , so it holds. That is with : two orders for each pair, hence numbers,
The split
The same argument with the roles reversed, which the conditions permit because swapping the pair with the pair leaves them unchanged. Here and , giving , , and .
The three splits are exhaustive, so the total is
Answer 9