%I #10 Sep 26 2018 16:24:18
%S 1,2,3,4,5,6,3,7,8,9,3,10,5,11,12,13,5,14,3,15,16,17,3,18,19,20,21,22,
%T 5,23,3,24,25,26,27,28,5,29,30,31,5,32,3,33,34,35,3,36,37,38,39,40,5,
%U 41,42,43,44,45,3,46,5,47,48,49,50,51,3,52,53,54,3,55,5,56,57,58,59,60,3,61,62,63,3,64,65,66,67,68,5,69,70,71,72,73,74,75,5,76,77,78,5,79,3
%N Filter sequence which records for primes their residue modulo 4, and for all other numbers assigns a unique number.
%C Restricted growth sequence transform of function f defined as f(n) = A010873(n) when n is a prime, otherwise -n.
%C For all i, j:
%C a(i) = a(j) => A010873(i) = A010873(j),
%C a(i) = a(j) => A305801(i) = A305801(j),
%C a(i) = a(j) => A319714(i) = A319714(j).
%H Antti Karttunen, <a href="/A319704/b319704.txt">Table of n, a(n) for n = 1..100000</a>
%o (PARI)
%o up_to = 100000;
%o rgs_transform(invec) = { my(om = Map(), outvec = vector(length(invec)), u=1); for(i=1, length(invec), if(mapisdefined(om,invec[i]), my(pp = mapget(om, invec[i])); outvec[i] = outvec[pp] , mapput(om,invec[i],i); outvec[i] = u; u++ )); outvec; };
%o A319704aux(n) = if(isprime(n),-(n%4),n);
%o v319704 = rgs_transform(vector(up_to,n,A319704aux(n)));
%o A319704(n) = v319704[n];
%Y Cf. A010873, A305801, A319714.
%Y Cf. A002145 (positions of 3's), A002144 (positions of 5's).
%Y Cf. also A319350, A319705, A319706.
%K nonn
%O 1,2
%A _Antti Karttunen_, Sep 26 2018