login
Position of first occurrence of n in A090544.
3

%I #11 Jul 31 2023 10:08:35

%S 2,6,4,10,16,11,24,17,35,26,69,53,113,184,149,124,99,78,224,182,148,

%T 118,94,73,304,309,255,209,170,137,561,470,393,327,270,238,194,157,

%U 443,1352,1161,994,848,720,609,512,430,2967,2602,5056,4451,7132,6311,6475,5722

%N Position of first occurrence of n in A090544.

%p f := proc(k) k+numtheory[pi](k) ; end: A090544 := proc(n) local a,frep ; a := 1 ; frep := f(n) ; while not isprime(frep) do frep := f(frep) ; a := a+1 ; od ; RETURN(a) ; end: A090546 := proc(nmax) local a,m ; a := [seq(0,i=1..nmax)] ; for m from 2 to 10000 do a090544 := A090544(m) ; if a090544 <= nops(a) and op(a090544,a) = 0 then a := subsop(a090544=m,a) ; print(a090544,m) ; fi ; od ; RETURN(a) ; end: A090546(80) ; # _R. J. Mathar_, Apr 28 2007

%t nt = 55; (* required number of terms *)

%t pos[_] = 0;

%t f[k_] := k + PrimePi[k];

%t g[n_] := NestWhileList[f, f[n], CompositeQ] // Length;

%t s[m_] := With[{gn = g[n]}, Do[If[pos[gn] == 0, pos[gn] = n], {n, 2, m}]; Array[pos, nt]];

%t m = nt;

%t While[AnyTrue[s[m], # == 0&], m += nt];

%t s[m] (* _Jean-François Alcover_, Jul 31 2023 *)

%Y Cf. A090544, A090545.

%K nonn

%O 1,1

%A _Amarnath Murthy_, Dec 09 2003

%E More terms from _R. J. Mathar_, Apr 28 2007