login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A371924 a(n) is the least b such that prime(n)-1 divides b!. 1

%I #24 Apr 28 2024 11:31:32

%S 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,

%T 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,

%U 10,131,67,9,23,7,47,73,17,31,13,79,11,7,173,29,11

%N a(n) is the least b such that prime(n)-1 divides b!.

%C This list is connected to Pollard's p-1 algorithm, using the version of the algorithm iterating over all positive integers. Say a large number m has two distinct prime factors q and r, and using Pollard's p-1 algorithm someone wishes to obtain the prime factors. Say q = 223 and r = 307. As prime(48) = 223 and a(48) = 37, given a random "a" coprime to m the factor 223 will be discovered in 37 steps. Also, as prime(63) = 307 and a(63) = 17, given a random "a" coprime to m the factor 307 will be discovered in 17 steps. Note that after 37 steps both factors will be discovered, so the algorithm will return m, failing to discover either prime factor. Therefore, when 17 <= b < 37 the prime factor 307 will be discovered. Note that on rare occasions, for a given "a" value, by chance p divides (a^b! - 1), so it is possible that for some "a" values the actual b value will be less. But, for any "a" value and prime p = prime(n), it is guaranteed that b <= a(n).

%H Samuel Harkness, <a href="/A371924/b371924.txt">Table of n, a(n) for n = 1..10000</a>

%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Pollard%27s_p_%E2%88%92_1_algorithm">Pollard's p-1 algorithm</a>

%e 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.

%t a371924[p_] :=

%t Module[{a, d, f, u, v}, f = FactorInteger[p - 1]; d = {};

%t For[a = 1, a <= Length[f], a++,

%t u = f[[a]];

%t v = u[[1]]^u[[2]];

%t i = 1;

%t While[! Divisible[(u[[1]]*i)!, v], i++]; AppendTo[d, u[[1]]*i]];

%t Return[Max[d]]]

%t list = {};

%t For[p = 1, p <= 71, p++,

%t AppendTo[list, {p, a371924[Prime[p]]}]]

%t Print[list]

%o (PARI) a(n) = my(b=1, q=prime(n)-1); while (b! % q, b++); b; \\ _Michel Marcus_, Apr 15 2024

%o (Python)

%o from sympy import prime

%o def A371924(n):

%o m = prime(n)-1

%o b, k = 1, 1%m

%o while k:

%o b += 1

%o k = k*b%m

%o return b # _Chai Wah Wu_, Apr 25 2024

%Y Cf. A000040, A002034, A023503, A092965.

%K nonn

%O 1,2

%A _Samuel Harkness_, Apr 12 2024

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified July 11 19:26 EDT 2024. Contains 374234 sequences. (Running on oeis4.)