1 is a product of 0 primes such that every 2 positive integers that multiply to it add up to a prime.
1*1=1, 1+1=2
2 is a product of 1 prime such that every 2 positive integers that multiply to it add up to a prime.
1*2=2, 1+2=3
6=2*3 is a product of 2 primes such that every 2 positive integers that multiply to it add up to a prime.
1*6=6, 1+6=7
2*3=6, 2+3=5
30=2*3*5 is a product of 3 primes such that every 2 positive integers that multiply to it add up to a prime.
1*30=30, 1+30=31
2*15=30, 2+15=17
3*10=30, 3+10=13
5*6=30, 5+6=11
1. What is the smallest product of 4 primes such that every 2 positive integers that multiply to it add up to a prime?
2. What is the smallest product of 5 primes such that every 2 positive integers that multiply to it add up to a prime?
Except for '1', only even numbers can test positive because (1,odd) would be one pair of factors, and 1 + odd is even, and 2 is the only even prime. I searched the even numbers up to 10,000,000
n smallest
1 2
2 6
3 30
4
2105
186162Which is oeis A293756 with no other entries, which I discovered after the fact.
Here are the other integers that met the criteria for 4 and 5.
4: [210, 330, 462, 1870, 4218, 5590, 6042, 7638, 13962, 14410, 22570, 24682, 26202, 32838, 35098, 39678, 43498, 43990, 52782, 62458, 62538, 93262, 125302, 127290, 130782, 152310, 155170, 201910, 221622, 227110, 236062, 272902, 296718, 300490, 309358, 331710, 339262, 355762, 410278, 418342, 476578, 489742, 670558, 685518, 691062, 710682, 810418, 867262, 868330, 950482, 989422, 1011558, 1019530, 1031298, 1172938, 1184682, 1274938, 1307590, 1336602, 1489818, 1500618, 1558342, 1619662, 1685170, 1804870, 1908082, 1925610, 1940422, 2043490, 2066758, 2263438, 2301258, 2325810, 2401870, 2462122, 2584558, 2785762, 2896738, 2998318, 3044710, 3109390, 3117678, 3244858, 3347458, 3395478, 3452178, 3583918, 3746338, 4202958, 4206610, 4274418, 4346818, 4423182, 4758502, 4978030, 5263630, 5283982, 5353342, 5435362, 5703478, 5721802, 5735262, 5880322, 5968438, 5988442, 6046870, 6445938, 6458782, 6870910, 7253878, 7283698, 7315378, 7713178, 8586622, 8870178, 8962798, 9052738, 9195778, 9838378],
5: [186162, 899970, 3047410]
---------------
def prime_factor(n):
""" for integer n, return a list of all the prime factors """
top = n // 2
factors = []
for i in range(2,top+1):
while n/i % 1 == 0:
factors.append(int(i))
n = n/i
if n == 1:
return factors
if n != 1:
factors.append(int(n))
return factors
def isprime(n):
'''check if integer n is a prime'''
n = abs(int(n))
if n < 2:
return False
if n == 2:
return True
if not n & 1:
return False
for x in range(3, int(n**0.5)+1, 2):
if n % x == 0:
return False
return True
def factorpairs(n):
""" for integer n, return a list of all the factors including 1 and n """
# ans = [1,n]
ans = []
for i in range(2,2+int(n**.5)):
if n%i == 0:
ans.append(i)
ans.append(int(n/i))
ans = sorted(ans)
finalans = [[1,n]]
while len(ans) > 1:
finalans.append([ans[0],ans[-1]])
ans.pop()
ans.pop(0)
if len(ans) == 1:
finalans.append([ans[0],ans[-1]])
return finalans
def test(n):
for t in factorpairs(n):
if not isprime(sum(t)):
return False
return True
big = 10000000
goods = []
goodDict = {}
for i in range(0,big,2):
if test(i):
goods.append(i)
size = len(prime_factor(i))
if size not in goodDict:
goodDict[size] = [i]
else:
goodDict[size].append(i)
primes = [i for i in range(10000) if isprime(i)]
print(goodDict)
|
Posted by Larry
on 2023-04-19 08:13:05 |