All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
What is My Shop Number? (Posted on 2024-12-18) Difficulty: 3 of 5
I am getting a new sign for my shop, and instead of showing the shop number as numeric digits, it will be spelled out in capital letters, one word per digit. For example, if my shop number were 103, it would be painted as ONE ZERO THREE.

The sign painter is a little eccentric, and instead of charging by the hour, he charges by the brush stroke, which can be any shape and can touch, but must not cover, an already painted area (except where changing direction). He paints capital letters in a simple style (no serifs) and does not use two strokes where a single stroke will do. For example, E, F, G, H, I, N, O, R, S, T, U, V, W, X, Z would require 2, 2, 2, 3, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, and 1 strokes, respectively.

My shop number, which I had spelled out for the painter when he arrived, is a prime number, consisting of three different digits. He charges $1 per stroke, regardless of the length of the stroke. By coincidence, the cost of my number in dollars was equal to the sum of the three digits in the shop number and was a prime.

What is my shop number?

No Solution Yet Submitted by K Sengupta    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Computer solution Comment 2 of 2 |
E, F, G, H, I, N, O, R, S, T, U, V, W, X, Z 
2, 2, 2, 3, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1

The shop number is a 3-digit prime whose sod() is also prime.  Moreover, it has 3 distinct digits.  There are only 43 such numbers.

The shop number is 829 whose sod() is 19 and whose cost is also 19.

-----------
shopNs = [i for i in range(100,1000) if isprime(i) and isprime(sod(i)) and len(str(i)) == len(set(str(i)))]

letters = 'efghinorstuvwxz'
counts = [2, 2, 2, 3, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1]
spellNs = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']

costs = []
for n in spellNs:
    cost = 0
    for char in n:
        location = letters.index(char)
        cost += counts[location]
    costs.append(cost)

for shopN in shopNs:
    thissod = sod(shopN)
    cost = 0
    for digit in str(shopN):
        cost += costs[int(digit)]
    if cost == thissod:
        print(shopN, cost, thissod)

  Posted by Larry on 2024-12-18 17:57:56
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (5)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information