A295887 Filter sequence combining A003557(n) and A173557(n); the restricted growth sequence transform of A291756.
1, 1, 2, 3, 4, 2, 5, 6, 7, 4, 8, 9, 10, 5, 11, 12, 13, 7, 14, 15, 10, 8, 16, 17, 18, 10, 19, 20, 21, 11, 22, 23, 24, 13, 25, 26, 27, 14, 25, 28, 29, 10, 30, 31, 32, 16, 33, 34, 35, 18, 36, 37, 38, 19, 29, 39, 27, 21, 40, 41, 42, 22, 43, 44, 45, 24, 46, 47, 48, 25, 49, 50, 51, 27, 52, 53, 42, 25, 54, 55, 56, 29, 57, 37, 58, 30, 59, 60, 61, 32, 51, 62, 42, 33, 51
Offset: 1
Keywords
Examples
The first ten terms of the sequence f(n) = (1/2)*(2 + ((A003557(n) + A173557(n))^2) - A003557(n) - 3*A173557(n)) are 1, 1, 2, 3, 7, 2, 16, 10, 9, 7. When we assign to each newly occurring term the least unused number k so far (starting by giving k=1 for the initial term, this k increases by one for each new distinct term produced by f(n) when n grows), and for each repeated term the same number it was given the previous time (equal to the number it was given for the first time), we obtain 1, 1, 2, 3, 4, 2, 5, 6, 7, 4, the first 10 terms of this sequence. Note how f(10) = 7 gets 4 because when seven occurred for the first time at f(5), it was the 4th distinct new number in that sequence. This is also true for the sequence A291756 although there the terms are different: 1, 1, 2, 5, 7, 2, 16, 25, 31, 7.
Links
- Antti Karttunen, Table of n, a(n) for n = 1..65537
- Eric Weisstein's World of Mathematics, Pairing Function
- Wikipedia, Pairing Function
Programs
-
PARI
allocatemem(2^30); up_to = 65537; 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])); } A003557(n) = { my(f=factor(n)); for (i=1, #f~, f[i, 2] = max(0,f[i, 2]-1)); factorback(f); }; A173557(n) = my(f=factor(n)[, 1]); prod(k=1, #f, f[k]-1); \\ This function from Michel Marcus, Oct 31 2017 Anotsubmitted7(n) = (1/2)*(2 + ((A003557(n)+A173557(n))^2) - A003557(n) - 3*A173557(n)); write_to_bfile(1,rgs_transform(vector(up_to,n,Anotsubmitted7(n))),"b295887.txt");
Comments