17

The number M = 124563987 is the smallest number which uses all the non-zero digits once each and which has the property that none of the pairs of its consecutive digits makes a prime number. For example, the 5th and 6th digits of M make the number 63 which is not prime. N is the largest number which uses all the non-zero digits once each and which has the property that none of the pairs of its consecutive digits makes a prime number.

What are the 5th and 6th digits of N?

A. 6 and 3 B. 5 and 4 C. 5 and 2 D. 4 and 8 E. 3 and 5

Answer

E. 3 and 5

SOLUTIOn

For convenience, in this solution by a subnumber of a positive number n we mean a number formed from consecutive digits of n. For example, the two-digit subnumbers of 1234 are 12, 23 and 34, and the three-digit subnumbers of 1234 are 123 and 234. Note that this is not standard mathematical terminology, but has been introduced just for the purposes of this question.

We note first that 63 and 93 are the only numbers formed of two different non-zero digits with 3 as the unit digits that are not primes.

It follows that, if the digit 3 is not the first digit of the number N, the digit 3 could only occur in N immediately after either the digit 9 or the digit 6.We construct N by beginning with the largest digit 9, and then use all the other non-zero digits once each by always choosing the largest digit not yet used subject to the condition that 3 comes immediately after 9 or immediately after 6. In this way we obtain the number 987635421.We now see that in the number 987635421 none of the two-digit subnumbers is a prime. Any larger number using all the digits must either begin 98765... or 98764..., but in each case the 3would follow either 1,2,4 or 5, and so produce a two-digit subnumber that is a prime.Therefore the largest number with the required property is N = 987635421. It follows that the5th and 6th digits of N are 3 and 5.

Our Classes

FAQ

Find quick answers to common questions about our lessons, pricing, scheduling, and how Exact Science can help your child excel.
Where do you hold your classes?
We hold our classes online or on-site on Saturdays at our branch in Pimlico Academy, London.
You can find our timetable here.
What do you need to start learning online?
For lessons you only need a computer or phone with a microphone, camera and Internet access. Wherever you are - in London, Nottingham, New York or Bali - online lessons will be at hand.
When can I take the trial lesson?
You can get acquainted with the school at any time convenient for you. To do this, just leave a request and sign up for a lesson.
What should I expect from the trial lesson?
The trial lesson is a 30-minute online session designed to get a sense of how your child approaches mathematical thinking and problem solving. (In practice, it often runs a bit longer if the student is engaged!)

We typically explore a range of fun and challenging problems drawn from competitions. We adapt the difficulty based on how the student responds, aiming to make it both accessible and stimulating.

After the session, we’ll have a quick conversation with the parent to share observations and suggest a personalised path forward.
I can't attend class, what should I do?
It is OK, it happens! Students have the opportunity to cancel a lesson up to 8 hours before the scheduled time without loss of payment. So you can reschedule it for a convenient time, and the teacher will have the opportunity to
I don't have much free time, will I have time to study?
Learning can take place at your own pace. We will select a convenient schedule and at any time we will help you change the schedule, take a break or adjust the program.
How long is one lesson?
All classes last 1 hour.

What our students and parents say about learning with us

"Olympiad Maths Lessons helped me a lot to get the Gold medal in Junior Maths Challenge"
St. Paul's Student
"Thanks to the 'Data Science' and 'Coding in Python' lessons I got accepted to my dream university."
Michael
Data Science Student
Warwick University
"Great courses, which thoroughly explained topics beyond the capability of the GCSE answer sheet. Thanks so much."
Ivan
GCSE Student in Dubai
"Financial Mathematics! Best course to understand Python and Mathematics behind Finance!"
Gleb
VC Investor
"We got silver in PMC! Thanks George!"
Mum of St. Paul's Student
Prepare for the Primary Maths Challenge
"My daughter took a batch of 10 classes with George to understand Python with Turtle. I found George extremely knowledgeable and accessible."
Dad of Latymer School Student
Python with Turtle

Contact us

...or ask us anything

Ask about our courses and offerings, and we will help you choose what works best for you.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.