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

Home > Numbers
Fours and Fives Crossed Fortune Formulation (Posted on 2023-02-03) Difficulty: 3 of 5
In this puzzle, letters have been consistently replaced by digits, where:
• The same letter is substituted by the same digit.
• Different letters are substituted by different digits.
• No number can contain any leading zero.

It is known that each of the numbers FOUR and FIVE is a perfect square.

Furthermore, it is known that the each of the numerical answers to the undernoted queries is constituted entirely by the digits 4 and 5.

• (a) How many squares are strictly between FOUR and FIVE?
• (b) What is one-tenth of TEN - FIVE + FOUR?
• (c) What is the lowest positive integer that must be added to TEN to make it a perfect square?

Determine the value of FORTUNE.

Source: Adapted from Enigma #674 that appeared on "New Scientist" in 1992.

See The Solution Submitted by K Sengupta    
Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Solution | Comment 1 of 4
I found one solution which satisfies all criteria
FOUR FIVE TEN (a)  (b)  (c)  FORTUNE
1024 1369 895  4    55   5   1048259

---------------  summary of findings
I found three sets of two squares for FOUR and FIVE with the same first digit and all 6 other digits being distinct and also criterion (a), there are 4 or 5 squares between FOUR and FIVE.  Below are [FOUR, FIVE], #of squares between FOUR and FIVE
[[[1024, 1369], 4], [[2304, 2916], 5], [[7056, 7921], 4]]

This narrowed a little when also required to satisfy condition b.  The possible values for "TEN" were: 795, 895, 567, 568
And if "one-tenth of TEN - FIVE + FOUR" must contain only 4s and 5s, the possible values for this calculation:   45, 55, -4.5, -4.4
And the candidates for FORTUNE:  1047259, 1048259, 2345076, 2345086

Finally, for the condition in (c):
The possible triplets below are "TEN", # added to TEN to make a square, that square:
[795, 46, 841], [895, 5, 900], [567, 9, 576], [568, 8, 576]
the second number of each group is the number to be added, and this must contain only 4s and 5s, so all that is left is [895, 5, 900]

---------------   CODE
from itertools import combinations
lo = int(1000**.5)+1
hi = int(10000**.5)
squares4d = [i*i for i in range(lo,hi)]
squaresBy1st = [[] for i in range (10)]
non45digits = [str(i) for i in range (10) if i !=4 and i !=5]
fourfives =  []
squaresbetween = []
criterion_a = []
criterion_b = []
possible_ten_values = []
poss_one_tenth_of_mysum_values = []
values_for_FORTUNE = []
mustbeaddedtoTEN = []

for s in squares4d:
    firstDigit = int(str(s)[0])
    squaresBy1st[firstDigit].append(s)
for fD in range(1,10):
    for pair in combinations(squaresBy1st[fD],2):
        uniqueDigits = len( set(str(pair[0])+str(pair[1]) ))   
        if uniqueDigits == 7:
            fourfives.append(sorted(list(pair)))

for ff in fourfives:
    betw = squares4d.index(ff[1]) - squares4d.index(ff[0]) - 1 
    if ( betw ) == 4:
        criterion_a.append(ff)
        squaresbetween.append([ff,betw])
    if ( betw ) == 5:
        criterion_a.append(ff)
        squaresbetween.append([ff,betw])
print('Meets criterion a',  squaresbetween)

allDigits = [i for i in range(10)]
for p in criterion_a:
    four = str(p[0])
    five = str(p[1])
    f = int(four[0])
    o = int(four[1])
    u = int(four[2])
    r = int(four[3])
    i = int(five[1])
    v = int(five[2])
    e = int(five[3])
    takens = [f,o,u,r,i,v,e]
    pool = [i for i in allDigits if i not in takens]
    for t in pool:
        for n in pool:
            if n == t:
                continue
            ten = 100*t + 10*e + n
            mysum = ten - int(five) + int(four)
            quotient = mysum/10
            if quotient%1 == 0:
                quotient = int(quotient)
            all4sand5s = True
            
            for c in non45digits:
                if c in str(quotient):
                    all4sand5s = False
            count10 = 0
            if all4sand5s:
                fortune = f*10**6 + o*10**5 + r*10**4 + t*10**3 + u*10**2 + n*10**1 + e
                values_for_FORTUNE.append(fortune)
                possible_ten_values.append(ten)
                poss_one_tenth_of_mysum_values.append(quotient)
                if p not in criterion_b:
                    criterion_b.append(p)
squares = [i*i for i in range(1000)]
for item in possible_ten_values:
    largerSquares = [i for i in squares if i > item]
    myDifference = sorted(largerSquares)[0] - item
    mustbeaddedtoTEN.append([item, myDifference, item + myDifference])

print('Meets criteria a and b', criterion_b)
print('one tenth of sum', poss_one_tenth_of_mysum_values)
print(possible_ten_values)
print(values_for_FORTUNE)
print(mustbeaddedtoTEN)


  Posted by Larry on 2023-02-03 10:46:35
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 (3)
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