%I #22 Sep 30 2019 09:06:54
%S 1,4,6,7,8,11,21,32,73,97,89,79,8,11,31,73,47,35,63,76,97,101,201,112,
%T 311,313,713,917,819,128,921,929,739,347,943,749,57,95,79,38,93,79,8,
%U 11,31,73,47,35,73,97,101,301,203,112,311,313,713,917,819,128
%N a(n) is the reversal of the next composite after a(n-1) if n is prime, otherwise it is the reversal of the next prime after a(n-1), starting with a(1) = 1.
%C Inspired by A326344.
%C The sequence is not periodic but bounded: a(n) <= 994 = a(1658) = a(2112) = a(2412) = a(3110) = ... .
%H Alois P. Heinz, <a href="/A326892/b326892.txt">Table of n, a(n) for n = 1..20000</a>
%H Alois P. Heinz, <a href="/A326892/a326892.jpg">Plot of the first 10^6 terms</a>
%p c:= n-> (k-> `if`(isprime(k), c(k), k))(n+1):
%p a:= proc(n) option remember; `if`(n=1, 1,
%p (s-> parse(cat(s[-i]$i=1..length(s))))(""||(
%p `if`(isprime(n), c(a(n-1)), nextprime(a(n-1))))))
%p end:
%p seq(a(n), n=1..100);
%Y Cf. A000040, A002808, A004086, A113646, A151800, A326344.
%K nonn,look,base
%O 1,2
%A _Alois P. Heinz_, Sep 13 2019