login
Restricted growth sequence of A285333.
2

%I #5 May 18 2017 21:48:54

%S 1,2,3,3,4,5,5,4,6,5,7,6,8,9,9,5,10,9,11,8,12,13,14,9,13,6,15,11,16,

%T 17,17,8,18,17,19,13,20,17,21,8,22,17,23,24,25,23,26,13,27,11,28,16,

%U 29,30,31,17,32,9,33,34,24,35,35,6,36,37,38,39,40,41,42,13,43,44,45,28,46,28,34,6,47,48,49,21,50,35,51,39,52,53,54,55,56,57,58,11,59

%N Restricted growth sequence of A285333.

%H Antti Karttunen, <a href="/A286544/b286544.txt">Table of n, a(n) for n = 0..8191</a>

%o (PARI)

%o allocatemem(2^30);

%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 A019565(n) = {my(j,v); factorback(Mat(vector(if(n, #n=vecextract(binary(n), "-1..1")), j, [prime(j), n[j]])~))}; \\ This function from _M. F. Hasler_

%o A048675(n) = my(f = factor(n)); sum(k=1, #f~, f[k, 2]*2^primepi(f[k, 1]))/2; \\ _Michel Marcus_, Oct 10 2016

%o A007947(n) = factorback(factorint(n)[, 1]); \\ From _Andrew Lelechenko_, May 09 2014

%o A065642(n) = { my(r=A007947(n)); if(1==n,n,n = n+r; while(A007947(n) <> r, n = n+r); n); };

%o A285332(n) = { if(n<=1,n+1,if(!(n%2),A019565(A285332(n/2)),A065642(A285332((n-1)/2)))); };

%o A285333(n) = if(!n,n,if(!(n%2),A285332(n/2),A048675(A285332(n))));

%o write_to_bfile(0,rgs_transform(vector(8192,n,A285333(n-1))),"b286544.txt");

%Y Cf. A285332, A285333, A286543.

%K nonn

%O 0,2

%A _Antti Karttunen_, May 18 2017