%I #10 Oct 23 2019 16:41:51
%S 0,1,4,5,2,3,12,13,16,17,14,15,24,25,28,29,26,27,6,7,10,11,8,9,18,19,
%T 22,23,20,21,60,61,64,65,62,63,72,73,76,77,74,75,84,85,88,89,86,87,66,
%U 67,70,71,68,69,78,79,82,83,80,81,120,121,124,125,122,123,132,133,136,137,134,135,144,145,148,149,146,147,126,127,130,131
%N In primorial base representation of n, multiply by 2 all other digits except the least significant, and reduce each such product modulo prime(k) (to get the new digit), where k > 1 is the position of the digit, then convert back to decimal.
%H Antti Karttunen, <a href="/A328622/b328622.txt">Table of n, a(n) for n = 0..30029</a>
%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%H <a href="/index/Pri#primorialbase">Index entries for sequences related to primorial base</a>
%F a(n) = A276085(A328618(A276086(n))).
%e In primorial base (A049345) 199 is written as "6301" because 6*A002110(3) + 3*A002110(2) + 0*A002110(1) + 1*A002110(0) = 6*30 + 3*6 + 0*2 + 1*1 = 199. Multiplying each digit except the least significant by 2, and then reducing them modulo the corresponding prime leaves us with 2*6 mod 7, 2*3 mod 5, 2*0 mod 3, (with the least significant 1 staying the same), so we get "5101", which is the primorial base expansion of 157, thus a(199) = 157.
%e For 157, the new "doubled and reduced" expansion is 2*5 mod 7, 2*1 mod 5, 2*0 mod 3 and the trailing 1 stays intact, so we get "3201", which is the primorial base expansion of 103, thus a(157) = 103.
%o (PARI)
%o A002110(n) = prod(i=1,n,prime(i));
%o A276085(n) = { my(f = factor(n)); sum(k=1, #f~, f[k, 2]*A002110(primepi(f[k, 1])-1)); };
%o A276086(n) = { my(m=1, p=2); while(n, m *= (p^(n%p)); n = n\p; p = nextprime(1+p)); (m); };
%o A328618(n) = { my(f = factor(n), m, q); for(k=1, #f~, q = (f[k, 2]\f[k, 1]); m = (f[k, 2]%f[k, 1]); if(m&&(f[k,1]!=2), f[k, 2] = q*f[k, 1] + ((2*f[k, 2])%f[k, 1]))); factorback(f); };
%o A328622(n) = A276085(A328618(A276086(n)));
%Y Cf. A328623 (inverse), and also A289234.
%Y Cf. A002110, A049345, A276085, A276086, A328618.
%K nonn,base
%O 0,3
%A _Antti Karttunen_, Oct 23 2019