OFFSET
1,1
LINKS
Giovanni Resta, Table of n, a(n) for n = 1..400
EXAMPLE
x=10: p(10)=29,c(10)=18, Mod[29,18]=11 appears first here, so a(11)=10.
MATHEMATICA
f[x_] := Mod[Prime[x], FixedPoint[x+PrimePi[ # ]+1&, x]] t=Table[0, {256}]; Do[s=f[n]; If[s<257&&t[[s]]==0, t[[s]]=n], {n, 1, 400000}]; t
Module[{nn=500000, cmps, prs, len}, cmps=Select[Range[nn], CompositeQ]; len= Length[ cmps]; Table[SelectFirst[Thread[{Range[len], Prime[Range[len]], cmps}], Mod[#[[2]], #[[3]]] ==n&], {n, 23}]][[All, 1]] (* The program generates the first 23 terms of the sequence. *) (* Harvey P. Dale, Nov 26 2022 *)
PROG
(PARI) isc(n) = (n != 1) && !isprime(n);
lista(nn) = {my(vp = primes(nn), vc = select(x->isc(x), [1..nn])); for (n=1, 50, my(k=1); while((vp[k] % vc[k]) != n, k++; if ((k>#vp) || (k>#vc), return)); print1(k, ", "); ); } \\ Michel Marcus, Sep 02 2019
(PARI) a(n) = my(p=2); forcomposite(c=4, oo, if(p % c == n, return(primepi(p))); p = nextprime(p+1)); \\ Daniel Suteu, Sep 02 2019
CROSSREFS
KEYWORD
nonn
AUTHOR
Labos Elemer, Jul 30 2002
EXTENSIONS
a(24)-a(50) from Michel Marcus, Sep 02 2019
More terms from Giovanni Resta, Sep 03 2019
STATUS
approved