A286378 Restricted growth sequence computed for Stern-polynomial related filter-sequence A278243.
1, 2, 2, 3, 2, 4, 3, 5, 2, 6, 4, 7, 3, 8, 5, 9, 2, 10, 6, 11, 4, 12, 7, 13, 3, 13, 8, 14, 5, 15, 9, 16, 2, 17, 10, 18, 6, 19, 11, 20, 4, 21, 12, 22, 7, 23, 13, 24, 3, 24, 13, 25, 8, 26, 14, 27, 5, 28, 15, 29, 9, 30, 16, 31, 2, 32, 17, 33, 10, 34, 18, 35, 6, 36, 19, 37, 11, 38, 20, 39, 4, 40, 21, 41, 12, 42, 22, 43, 7, 44, 23, 45, 13, 46, 24, 47, 3, 47, 24, 48
Offset: 0
Keywords
Examples
For n=1, A278243(1) = 2, which has not been encountered before, thus we allot for a(1) the least so far unused number, which is 2, thus a(1) = 2. For n=2, A278243(2) = 2, which was already encountered as A278243(1), thus we set a(2) = a(1) = 2. For n=3, A278243(3) = 6, which has not been encountered before, thus we allot for a(3) the least so far unused number, which is 3, thus a(3) = 3. For n=23, A278243(23) = 2520, which has not been encountered before, thus we allot for a(23) the least so far unused number, which is 13, thus a(23) = 3. For n=25, A278243(25) = 2520, which was already encountered at n=23, thus we set a(25) = a(23) = 13.
Links
Crossrefs
Programs
-
Mathematica
a[n_] := a[n] = Which[n < 2, n + 1, EvenQ@ n, Times @@ Map[#1^#2 & @@ # &, FactorInteger[#] /. {p_, e_} /; e > 0 :> {Prime[PrimePi@ p + 1], e}] - Boole[# == 1] &@ a[n/2], True, a[#] a[# + 1] &[(n - 1)/2]]; With[{nn = 100}, Function[s, Table[Position[Keys@ s, k_ /; MemberQ[k, n]][[1, 1]], {n, nn}]]@ Map[#1 -> #2 & @@ # &, Transpose@ {Values@ #, Keys@ #}] &@ PositionIndex@ Table[Times @@ MapIndexed[Prime[First@#2]^#1 &, Sort[FactorInteger[#][[All, -1]], Greater]] - Boole[# == 1] &@ a@ n, {n, 0, nn}]] (* Michael De Vlieger, May 12 2017 *)
-
PARI
up_to = 65537; 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; }; write_to_bfile(start_offset,vec,bfilename) = { for(n=1, length(vec), write(bfilename, (n+start_offset)-1, " ", vec[n])); } A046523(n) = { my(f=vecsort(factor(n)[, 2], , 4), p); prod(i=1, #f, (p=nextprime(p+1))^f[i]); }; \\ From A046523 A003961(n) = my(f = factor(n)); for (i=1, #f~, f[i, 1] = nextprime(f[i, 1]+1)); factorback(f); \\ From A003961 A260443(n) = if(n<2, n+1, if(n%2, A260443(n\2)*A260443(n\2+1), A003961(A260443(n\2)))); A278243(n) = A046523(A260443(n)); v286378 = rgs_transform(vector(up_to+1,n,A278243(n-1))); A286378(n) = v286378[1+n];
Comments