login
Restricted growth sequence computed for A252750.
3

%I #5 May 13 2017 17:20:09

%S 1,1,2,3,4,5,6,3,2,7,8,1,9,10,11,12,7,13,14,5,15,16,17,14,18,19,20,21,

%T 22,23,24,12,25,1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,

%U 43,44,45,46,47,48,49,50,51,52,53,54,55,1,5,56,31,57,58,59,7,60,61,62,17,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81

%N Restricted growth sequence computed for A252750.

%H Antti Karttunen, <a href="/A286450/b286450.txt">Table of n, a(n) for n = 1..10000</a>

%o (PARI)

%o rgs_transform(invec) = { my(occurrences = Map(), outvec = vector(length(invec)), u=1); for(i=1, length(invec), if(mapisdefined(occurrences,invec[i]), my(pp = mapget(occurrences, invec[i])); outvec[i] = outvec[pp] , mapput(occurrences,invec[i],i); outvec[i] = u; u++ )); outvec; };

%o write_to_bfile(start_offset,vec,bfilename) = { for(n=1, length(vec), write(bfilename, (n+start_offset)-1, " ", vec[n])); }

%o A003961(n) = my(f = factor(n)); for (i=1, #f~, f[i, 1] = nextprime(f[i, 1]+1)); factorback(f); \\ This function from _Michel Marcus_

%o A005940(n) = { my(p=2, t=1); n--; until(!n\=2, if((n%2), (t*=p), p=nextprime(p+1))); t }; \\ Modified from code of _M. F. Hasler_

%o A252750(n) = (A003961(A005940(n+1)) - (2 * A005940(n+1)));

%o write_to_bfile(1,rgs_transform(vector(10000,n,A252750(n))),"b286450.txt");

%Y Cf. A252750, A286448, A286449.

%K nonn

%O 1,3

%A _Antti Karttunen_, May 13 2017