Find the largest known number that is the sum of two distinct primes in exactly two ways.
Hint: it's smaller than 100. If you find a bigger one, don't share it here.
The way I would tackle it is with a little Python script...
Posting a bit earlier than usual, won't have time later.
Previous iteration: #700785
37 + 31 = 61 + 7 = 68
I couldn't resist!
import pandas as pd primes = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97] data = [] for i in range(len(primes)): for j in range(i+1,len(primes)): x = primes[i] y = primes[j] z = x + y data.append({'z':z,'x':x,'y':y}) data = pd.DataFrame.from_dict(data) counts = data.groupby('z').agg(count=('z','count')) counts.loc[counts['count']==2]The answer (conditional on being less than 100) is 68. But there are more that are greater than 100.
68 = 7 + 61 68 = 31 + 37
68 is correct.
Are you sure about the ones larger than 100 though? Maybe you need to add all the primes up to that supposed candidate number in your primes list to make sure they don't end up breaking that "exactly two" constraint.
Ah, you're right about larger than 100. I can't find one larger than 68. Revised script:
import pandas as pd def get_primes(n): out = list() sieve = [True] * (n+1) for p in range(2, n+1): if (sieve[p]): out.append(p) for i in range(p, n+1, p): sieve[i] = False return out n = 100 primes = get_primes(n) data = [] for i in range(len(primes)): for j in range(i+1,len(primes)): x = primes[i] y = primes[j] z = x + y if z<=n: data.append({'z':z,'x':x,'y':y}) data = pd.DataFrame.from_dict(data) counts = data.groupby('z').agg(count=('z','count')).reset_index() counts.loc[counts['count']==2].sort_values(by='z',ascending=False).head(1)I tried up to n=10,000 and nothing higher than 68 was found.
Fancy pancy there with your Sieve of Eratosthenes ;)
Smaller than 100 I wouldn't even have bothered with pandas lol. Good habit tho. The kind of script that I would have chatGPTed lol
I’m just so used to pandas that it’s the first method I thought of
Did you change territories on purpose?
I hadn't noticed. Force of habit i guess, ~science is where i usually post stuff except for these puzzles.
It'll be interesting to see how a well performing post affects my territory earnings though.
I'm tempted to keep posting them in ~science as this puzzle post seemed to have positively affected my territory fee earnings... not huge, but still, every little thing makes a difference in compensating the sats I'm losing at the moment.
It'll fit in the grand vision I have for this territory, where ~math will be one of the subterritories when that functionality rolls out...
Sounds like a plan!
32
29+3 19+13
A for effort. He worked on this for a solid hour and had 68 originally but made a slight mistake.
The number is 76
73 + 3 61 + 15
Is it 54? 47 + 7 41 + 13
{16, {{13, 3}, {11, 5}}}
{18, {{13, 5}, {11, 7}}}
{20, {{17, 3}, {13, 7}
{68, {{61, 7}, {37, 31}}} 61+7=68=37+31
Yes 68 is correct.
67 + 19 73 + 13 79 + 7 83 + 3
That's 4 ways. It has the be a number that satisfies this condition in exactly 2 ways.
11 + 5 13 + 3
deleted by author
11 + 7 13 + 5
deleted by author
Exactly two ways...
There are also 41 + 59 and 89 + 11 that add up to 100...
deleted by author
What about 19+73? ;)
I'll go to sleep now, will be interested to read other trials in the morning.
EDIT: Seems like you edited the answer I was answering to.
deleted by author
deleted by author