A371924 a(n) is the least b such that prime(n)-1 divides b!.
1, 2, 4, 3, 5, 4, 6, 6, 11, 7, 5, 6, 5, 7, 23, 13, 29, 5, 11, 7, 6, 13, 41, 11, 8, 10, 17, 53, 9, 7, 7, 13, 17, 23, 37, 10, 13, 9, 83, 43, 89, 6, 19, 8, 14, 11, 7, 37, 113, 19, 29, 17, 6, 15, 10, 131, 67, 9, 23, 7, 47, 73, 17, 31, 13, 79, 11, 7, 173, 29, 11
Offset: 1
Keywords
Examples
For n = 25, prime(25) = 97, so we will use p = 97. Then the prime factorization of p - 1 is p - 1 = 2^5 * 3. Note that for p - 1 to divide b!, the exponents for all prime factors in b! must be greater than or equal to the exponents for all prime factors in the prime factorization of p - 1. We find that 8! = 2^7 * 3^2 * 5 * 7 is the least b such that this is true, so a(25) = 8.
Links
- Samuel Harkness, Table of n, a(n) for n = 1..10000
- Wikipedia, Pollard's p-1 algorithm
Programs
-
Mathematica
a371924[p_] := Module[{a, d, f, u, v}, f = FactorInteger[p - 1]; d = {}; For[a = 1, a <= Length[f], a++, u = f[[a]]; v = u[[1]]^u[[2]]; i = 1; While[! Divisible[(u[[1]]*i)!, v], i++]; AppendTo[d, u[[1]]*i]]; Return[Max[d]]] list = {}; For[p = 1, p <= 71, p++, AppendTo[list, {p, a371924[Prime[p]]}]] Print[list]
-
PARI
a(n) = my(b=1, q=prime(n)-1); while (b! % q, b++); b; \\ Michel Marcus, Apr 15 2024
-
Python
from sympy import prime def A371924(n): m = prime(n)-1 b, k = 1, 1%m while k: b += 1 k = k*b%m return b # Chai Wah Wu, Apr 25 2024
Comments