login
A302779
Restricted growth sequence transform of ordered pair [Q(n-Q(n-1)), Q(n-Q(n-2))], the left & right summand of Hofstadter Q-sequence A005185.
2
1, 1, 2, 3, 3, 4, 5, 5, 6, 6, 6, 7, 8, 7, 9, 10, 9, 11, 11, 12, 12, 12, 12, 13, 14, 15, 13, 13, 13, 13, 16, 17, 18, 16, 19, 20, 21, 22, 19, 22, 23, 23, 24, 24, 24, 24, 24, 25, 26, 27, 28, 29, 30, 31, 28, 32, 25, 28, 25, 25, 25, 25, 33, 34, 35, 36, 37, 38, 39, 33, 40, 36, 41, 42, 43, 39, 44, 43, 45, 46, 47, 48, 48, 49, 50, 51, 52, 52, 49, 53, 53, 53, 53, 53, 53
OFFSET
1,3
COMMENTS
Restricted growth sequence transform of A286559.
PROG
(PARI)
up_to = 65537;
first_n_of_A005185(n) = { my(v=vector(n)); v[1]=v[2]=1; for(k=3, n, v[k]=v[k-v[k-1]]+v[k-v[k-2]]); (v); };
v005185 = first_n_of_A005185(up_to);
A005185(n) = v005185[n];
Aux302779(n) = if(n<3, 0, [A005185(n-A005185(n-1)), A005185(n-A005185(n-2))]);
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; };
write_to_bfile(start_offset, vec, bfilename) = { for(n=1, length(vec), write(bfilename, (n+start_offset)-1, " ", vec[n])); }
write_to_bfile(1, rgs_transform(vector(up_to, n, Aux302779(n))), "b302779.txt");
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Apr 27 2018
STATUS
approved