28
Score 100 8605
I used an algorithm that starts with one solution and repeatedly tries to split a prime \$p\$ in the solution into two other primes \$q_ 1\$ and \$q_ 2\$ that satisfy \$\frac1{p-1} = \frac1{q_1-1}+\frac1{q_2-1}\$.
It is known (and can be quickly checked) that the positive integer solutions to \$\frac1n = \frac1x + \frac1y\$ are in one-to-one ...
13
Score 263 385 425 426 with only primes < 1.000.000 (was: non-competitive, now it is; score can be increased by running the program longer)
I followed the same path as Wheat Wizard: iteratively search for primes in the solution that can be replaced with a longer list of primes with the same result. I wrote that Python program that does exactly this. It ...
11
Score 32 34 36
{5, 7, 11, 13, 17, 23, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 101, 113, 131, 137, 151, 211, 229, 241, 281, 313, 379, 401, 433, 457, 491, 521, 571, 601, 25117, 293362609}
This is an improvement of Arnauld's answer. I just noticed that
\$
\dfrac{1}{19-1}=\dfrac{1}{73-1}+\dfrac{1}{61-1}+\dfrac{1}{41-1}
\$
But 41 and 61 were already used in ...
7
Score 22
Just to get the ball rolling.
{5,7,11,13,17,19,23,31,37,41,43,47,53,59,61,67,71,79,137,491,25117,293362609}
Compute the fraction
I suspect that the sequence can be made arbitrary large, but my code is currently too messy and inefficient for anything significantly better than that.
3
Python 2.7, 341 301 253 bytes, optimized for speed
lambda x,y:(x==0and g(y))or(y==0and g(x))or(x*y and p(x*x+y*y))
def p(n,r=[2]):a=lambda n:r+range(r[-1],int(n**.5)+1);r+=[i for i in a(n)if all(i%j for j in a(i))]if n>r[-1]**2else[];return all(n%i for i in r if i*i<n)
g=lambda x:abs(x)%4>2and p(abs(x))
Try it online!
#pRimes. need at least one ...
1
Ruby -rprime, 65 60 80 bytes
Didn't notice the "can't use isPrime" rule...
->a,b{r=->n{(2...n).all?{|i|n%i>0}};c=(a+b).abs;r[a*a+b*b]||a*b==0&&r[c]&&c%4>2}
Try it online!
1
Mathematica, 149 Characters
If[a==0,#[[3]]&&Mod[Abs@b,4]==3,If[b==0,#[[2]]&&Mod[Abs@a,4]==3,#[[1]]]]&[(q=#;Total[Boole@IntegerQ[q/#]&/@Range@q]<3&&q!=0)&/@{a^2+b^2,Abs@a,Abs@b}]
The code doesn't use any standard prime number features of mathematica, instead it counts the number of integers in the list {n/1,n/2,...,n/n}...
Only top voted, non community-wiki answers of a minimum length are eligible
Related Tags
primes × 269code-golf × 231
math × 73
number-theory × 73
number × 54
sequence × 53
code-challenge × 25
decision-problem × 25
integer × 16
factoring × 15
arithmetic × 9
restricted-source × 9
fastest-code × 9
string × 8
fibonacci × 7
kolmogorov-complexity × 6
binary × 6
base-conversion × 6
cops-and-robbers × 6
source-layout × 5
ascii-art × 4
combinatorics × 4
date × 4
palindrome × 4
array-manipulation × 3