## Teaser 2956: A nice little earner

**From The Sunday Times, 19th May 2019** [link]

The “value” of a number is found by subtracting its first digit from the last. For example, 6, 72, 88 and 164 have values 0, −5, 0 and 3 respectively.

Raising funds for a local charity, I placed some raffle tickets numbered from 1 up to a certain 3-digit number, in a box. Participants then selected a ticket at random. If the value of their number was positive, they won that amount in £; if the value was negative, they contributed that [positive] amount in £. Otherwise no money changed hands.

All the tickets having been used, the total amount raised in £ was a rearrangement of the digits in that number of tickets.

How much was raised?

[teaser2956]

## Jim Randell 4:51 pm

on16 May 2019 Permalink |If the “value” is positive, we have to pay the ticket holder that amount. If it is negative, the ticket holder pays us. And if the value is zero nothing happens.

So in each case we lose an amount equal to the “value” of the ticket.

This Python program subtracts the values of the tickets, until we have a positive amount that can be rearranged to give the ticket number.

Run:[ @repl.it ]Solution:£249 was raised.The number of tickets is 942.

The next solution occurs with 91,727 tickets, and £12,779 raised.

LikeLike