Visiting England's Wirral Peninsula in 1853, Nathaniel Hawthorne came upon1 a queer battlemented house in the town of Bebington:

… quite a novel symbol of decay and neglect, …

… probably the whim of some half-crazy person.

On the wall, close to the street, there were certain eccentric inscriptions cut into slabs of stone, but I could make no sense of them.

The crazy person was resident Thomas Francis, and the inscriptions had apparently been commissioned to bemuse and entertain passersby.

Bebington
Three eccentric inscriptions Thomas Francis cut into slabs of stone on a house in the town of Bebington (Wirral Peninsula, England). They offer three puzzles, with the middle one reading as "Subtract 45 From 45 That 45 May Remain."

They offer three puzzles, with the middle one reading as

Subtract 45 From 45 That 45 May Remain.

This seems to refer to the following mathematical curiosity:

  987654321
- 123456789
-----------
  864197532

Each of these figures comprises the digits 1 to 9, so all have the same digit sum: 45.

The house was demolished in the 1960s, but the stones can be seen today in the foyer of the library at the Bebington Civic Medical Centre2.

Assignment

For a number $$n \in \mathbb{N}_0$$, the riddle

Subtract $$n$$ from $$n$$, that $$n$$ may remain.

has multiple solutions when ignoring the restriction that the numbers must be permutations of the digits 1 to 9. After all, there are several numbers $$i, j \in \mathbb{N_0}$$ ($$i > j$$) for which each of the three numbers $$i$$, $$j$$ and $$i - j$$ has digit sum $$n$$.

Your task:

Example

>>> digit_sum(987654321)
45
>>> digit_sum(123456789)
45
>>> digit_sum(864197532)
45

>>> issolution(987654321, 123456789)
True
>>> issolution(93243, 58134)
False

>>> solutions(1000, 2000)
1311
>>> solutions(2000, 3000)
1202
>>> solutions(3000, 4000)
1128

Epilogue

The first stone presents the image of an inn, The Two Crowns, and the following riddle:

My name And sign is thirty Shillings just, and he that will tell My Name Shall have a Quart on trust, for why is not Five the Fourth Part of Twenty the Same in All Cases?

This was easier to guess at the time of its inscription. The landlord of the Two Crowns was Mark Noble, the old English coin known as the noble was worth 6 shillings and eightpence, the mark was worth 13 shillings and fourpence, and two crowns were worth 10 shillings. Together these values total 30 shillings (a shilling was worth 12 pence).

The last puzzle is the easiest:

  AR
    UBB
I
  NGS
TONEF
  ORAS
 SE
S

Read this straight through and you get A RUBBING STONE FOR ASSES — possibly a comment by Francis on the loiterers who would gather outside his home.