# Tag Info

### Odds for second smallest prime factor

PARI/GP, 102 bytes use the formula in A342479 (numerators) and A342480 (denominators)  f(n) = \left\{ \begin{array}{l} p = \text{prime}(n), \\ q = \{ q \in \mathbb{N} \,|\, q < p \wedge \text{...
• 5,811

### Odds for second smallest prime factor

Ruby, 75 bytes ->n{a=1;(2...n).sum{|x|a*=1-1r/x*z=1[(2...x).sum{|y|1[x%y]}];1r/~-x*z}*a/n} Try it online! How? Wait for Arnauld to post a Javascript solution, ...
• 21.9k

### Odds for second smallest prime factor

Wolfram Language (Mathematica), 51 bytes D[Times@@(1+(x-1)/Array[p=Prime,#-1]),x]/p@#/.x->0& Try it online! An unnamed function taking a 1-indexed integer <...
• 15.7k

### Odds for second smallest prime factor

K (ngn/k), 25 24 bytes {+/%/|x,y,*/\y-1}.1`pri\ Try it online! Uses the formula from Bubbler's Jelly answer. ...
• 20.4k

### Odds for second smallest prime factor

PARI/GP, 40 bytes p->prod(q=1,p-1,1+isprime(q)*x/q)'/p%x++ Attempt This Online! Based on the formula in @Bubbler's Jelly answer. Takes the derivative of the ...
• 48k

### Odds for second smallest prime factor

JavaScript (ES6), 66 bytes Takes a prime number and returns the probability as a floating point number. ...
• 192k

### Odds for second smallest prime factor

Charcoal, 28 bytes Ｎθ≔Φ…²θΠ﹪ι…²ιηＩ∕↨÷Π⊖η⊖η¹×θΠη Attempt This Online! Link is to verbose version of code. Explanation: Port of @Bubbler's formula. ...
• 170k

### Odds for second smallest prime factor

05AB1E, 9 bytes !Lfζ1èQÅA Port of @emanresuA's Vyxal answer. Try it online or verify the smaller test cases (the larger ones time out). Explanation: ...
• 126k

### Odds for second smallest prime factor

05AB1E, 13 bytes <ÅP<Ð>/Ps/Os/ Attempt This Online! Directly computes the answer. This seems way too long. Roughly equivalent to ...
• 10.5k

### Odds for second smallest prime factor

Jelly, 11 bytes ÆRµṖ’P-ƤS÷P Try it online! Let $P = p_1, p_2, \cdots, p_k$ be the list of primes strictly less than the input prime $p$. Then, the chance that ...
• 76.1k