OFFSET
2,1
COMMENTS
Main diagonal of A271873.
LINKS
Daniel Suteu, Table of n, a(n) for n = 2..27
PROG
(PARI) a(n) = forcomposite(c=1, , if(Mod(n, c)^(c-1)==1, if(omega(c)==n, return(c))))
(PARI)
fermat_psp(A, B, k, base) = A=max(A, vecprod(primes(k))); (f(m, l, p, j) = my(list=List()); forprime(q=p, sqrtnint(B\m, j), if(base%q != 0, my(v=m*q, t=q, r=nextprime(q+1)); while(v <= B, my(L=lcm(l, znorder(Mod(base, t)))); if(gcd(L, v) == 1, if(j==1, if(v>=A && if(k==1, !isprime(v), 1) && (v-1)%L == 0, listput(list, v)), if(v*r <= B, list=concat(list, f(v, L, r, j-1)))), break); v *= q; t *= q))); list); vecsort(Vec(f(1, 1, 2, k)));
a(n) = if(n < 2, return()); my(x=vecprod(primes(n)), y=2*x); while(1, my(v=fermat_psp(x, y, n, n)); if(#v >= 1, return(v[1])); x=y+1; y=2*x); \\ Daniel Suteu, Sep 02 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Felix Fröhlich, Apr 16 2016
EXTENSIONS
a(7)-a(17) from Daniel Suteu, Sep 02 2022
STATUS
approved