%I #32 Dec 15 2017 17:35:37
%S 1,24,27,30,55,65,95,145,155,185,205,822,894,2779,2863,8104,64270,
%T 174691,174779,1301989,1302457,3523478,9554955,9555045,9556455,
%U 70111213,70111247,514269523,514269599,10246934786,10246934962,204475046525,554805817358,4086199294828
%N Numbers n such that g(n) + sopfr(n) = n, where g(n)= number of nonprimes <=n (A062298) and sopfr(n) = sum of primes dividing n with repetition (A001414).
%C That is, numbers n such that primepi(n) = sopfr(n). - _Michel Marcus_, Mar 25 2017
%p with(numtheory):
%p a:= proc(n) option remember; local k;
%p for k from 1+ `if`(n=1, 0, a(n-1))
%p while add(i[1]*i[2], i=ifactors(k)[2])<>pi(k) do od; k
%p end:
%p seq(a(n), n=1..17); # _Alois P. Heinz_, Dec 18 2011
%t a[n_] := a[n] = Module[{k}, For[k = 1 + If[n==1, 0, a[n-1]], Sum[i[[1]] * i[[2]], {i, FactorInteger[k]}] != PrimePi[k], k++]; k]; a[1] = 1;
%t Table[Print["a(", n, ") = ", a[n]]; a[n], {n, 1, 25}] (* _Jean-François Alcover_, Mar 25 2017, after _Alois P. Heinz_ *)
%o (PARI) sopfr(n) = my(fac=factor(n)); sum(i=1, #fac~, fac[i,1]*fac[i,2]);
%o for (n=1,10^6, if (sopfr(n)==primepi(n), print1(n, ", "))) \\ edited by _Michel Marcus_, Mar 25 2017
%K nonn
%O 1,2
%A _Jason Earls_, Sep 15 2001
%E a(17)-a(21) from _Alois P. Heinz_, Dec 18 2011
%E a(22)-a(31) from _Donovan Johnson_, Jun 29 2012
%E a(32)-a(34) from _Giovanni Resta_, Mar 28 2017