OFFSET
0,2
COMMENTS
Restricted growth sequence transform of A004718, Per Nørgård's "infinity sequence".
The composer Per Nørgård's name is also written in the OEIS as Per Noergaard.
LINKS
Antti Karttunen, Table of n, a(n) for n = 0..65535
PROG
(PARI)
up_to = 65535;
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; };
A004718list(up_to) = { my(v=vector(up_to)); v[1]=1; v[2]=-1; for(n=3, up_to, v[n] = if(n%2, 1+v[n>>1], -v[n/2])); (v); }; \\ After code in A004718.
v004718 = A004718list(up_to);
A004718(n) = if(!n, n, v004718[n]);
v323907 = rgs_transform(vector(1+up_to, n, A004718(n-1)));
A323907(n) = v323907[1+n];
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Feb 09 2019
STATUS
approved