%I #11 Aug 07 2022 22:11:00
%S 0,1,2,3,2,5,3,7,3,3,5,11,3,13,7,5,7,17,5,19,5,7,11,23,7,5,13,7,7,29,
%T 5,31,5,11,17,7,11,37,19,13,7,41,7,43,11,7,23,47,7,7,7,17,13,53,17,11,
%U 7,19,29,59,11,61,31,7,31,13,11,67,17,23,7,71,23,73,37,7,19,11
%N a(0) = 0, a(1) = 1; for n > 1, a(n) is the last step before reaching 0 of the iterations x -> x - gpf(x) starting at n, where gpf = A006530.
%C For n > 1, a(n) is the unique prime in the iterations x -> x - gpf(x) starting at n and ending at 0.
%H Jianing Song, <a href="/A356427/b356427.txt">Table of n, a(n) for n = 0..10000</a>
%F For n > 0, a(n) = gpf(n) if n is in A356438; otherwise a(n) > gpf(n).
%e In the following examples the numbers produced by the iterations are listed together with their GPFs.
%e 48 (3) -> 45 (5) -> 40 (5) -> 35 (7) -> ... -> 7 (7) -> 0, so a(48) = 7.
%e 96 (3) -> 93 (31) -> 62 (31) -> 31 (31) -> 0, so a(96) = 31.
%o (PARI) a(n) = if(n>1, my(s=n); while(!isprime(s), s=s-vecmax(factor(s)[, 1])); s, n)
%Y Cf. A006530 (gpf), A076563, A309892, A356438, A356441.
%K nonn
%O 0,3
%A _Jianing Song_, Aug 07 2022