%I #10 Sep 29 2019 00:26:17
%S 1,2,3,4,1,4,1,4,6,16,13,22,19,4,6,16,13,22,19,4,6,16,13,22,24,1,4,6,
%T 11,12,17,18,4,6,16,18,23,24,1,4,1,4,1,4,6,16,13,22,24,1,4,6,11,12,22,
%U 24,1,4,1,4,1,4,6,16,18,4,1,4,6,16,13,22,19,4,6,16,18,4,1,4,6,16,13,22,24
%N a(1) = 1; thereafter, a(n) is the reversal of the next prime after a(n - 1) in base 5 if n is prime, and the reversal of the next composite after a(n - 1) in base 5 if n is composite.
%C The sequence is written in base 10.
%C Conjecture: the maximal value is 107, first attained at n = 883.
%H Robert Israel, <a href="/A327464/b327464.txt">Table of n, a(n) for n = 1..10000</a>
%p digrev:= proc(n) local L,i;
%p L:= convert(n,base,5);
%p add(L[-i]*5^(i-1),i=1..nops(L))
%p end proc:
%p nextcomp:= proc(n) local m;
%p for m from n+1 do if not isprime(m) then return m fi od
%p end proc:
%p A[1]:= 1:
%p for n from 2 to 100 do
%p if isprime(n) then A[n]:= digrev(nextprime(A[n-1]))
%p else A[n]:= digrev(nextcomp(A[n-1]))
%p fi
%p od:
%p seq(A[i],i=1..100); # _Robert Israel_, Sep 28 2019
%Y For bases 3,5,6,7,10 see A326894, A327464 = the present sequence, A327463, A327241, A326344.
%K nonn,base
%O 1,2
%A _N. J. A. Sloane_, Sep 27 2019