login
Restricted growth sequence of A286542.
5

%I #9 Jun 21 2017 12:13:55

%S 1,2,2,3,4,3,2,5,4,6,4,5,4,3,2,7,8,6,4,6,9,6,8,7,4,6,9,5,9,3,2,10,8,

%T 11,8,6,9,6,4,12,8,13,9,12,14,11,9,10,9,6,4,12,8,13,14,7,8,13,9,5,9,3,

%U 2,15,16,11,8,11,14,11,8,12,8,13,14,6,4,6,4,17,18,11,14,13,9,13,9,6,19,20,14,11,14,13,14,15,18,13,14,6,18,6,4,6,18,11,8

%N Restricted growth sequence of A286542.

%H Antti Karttunen, <a href="/A286543/b286543.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 A000120(n) = hammingweight(n);

%o A002110(n) = prod(i=1,n,prime(i));

%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 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 A046523(n) = { my(f=vecsort(factor(n)[, 2], , 4), p); prod(i=1, #f, (p=nextprime(p+1))^f[i]); }; \\ This function from _Charles R Greathouse IV_, Aug 17 2011

%o A286542(n) = if(!n,1,if(!(n%2),A002110(A000120(A285332(n/2))),A046523(A285332(n))));

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

%Y Cf. A046523, A285332, A286542, A286544.

%K nonn,look

%O 0,2

%A _Antti Karttunen_, May 18 2017