A304086 Inverse of A304085.
0, 1, 3, 6, 11, 2, 20, 7, 37, 13, 70, 5, 134, 23, 15, 259, 512, 45, 1031, 10, 26, 75, 2061, 4, 3974, 149, 49, 29, 8148, 14, 16167, 292, 80, 551, 19, 41, 32381, 1061, 159, 12, 64785, 32
Offset: 1
This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
Start with [1]; appending 2*[1] results in [1,2]; appending 3*[2,1] results in [1,2, 6,3]; appending 4*[3,6,2,1] results in [1,2,6,3, 12,24,8,4]; appending 5*[4,8,24,12,3,6,2,1] results in [1,2,6,3,12,24,8,4, 20,40,120,60,15,30,10,5]; next append 7*[5,10,30,15,60,120,40,20,4,8,24,12,3,6,2,1], multiplying by 7 since 6 is already found in the previous terms. Each new factor is in A050376: [2,3,4,5,7,9,11,13,16,17,19,23,25,29,...]. Continue in this way to generate all the terms of this sequence.
a = {1}; Do[a = Join[a, Reverse[a]*Min[Complement[Range[Max[a] + 1], a]]], {n, 1, 6}]; a (* Ivan Neretin, May 09 2015 *)
{A050376(n)= local(m, c, k, p); n--; if(n<=0, 2*(n==0), c=0; m=2; while( cA050376(n-1)*Vec(Polrev(A))));A[n]} for(n=0,63,print1(a(n),",")) \\ edited for offsets by Michel Marcus, Apr 04 2019
up_to_e = 13; v050376 = vector(up_to_e); A050376(n) = v050376[n]; ispow2(n) = (n && !bitand(n,n-1)); i = 0; for(n=1,oo,if(ispow2(isprimepower(n)), i++; v050376[i] = n); if(i == up_to_e,break)); A052330(n) = { my(p=1,i=1); while(n>0, if(n%2, p *= A050376(i)); i++; n >>= 1); (p); }; A003188(n) = bitxor(n, n>>1); A207901(n) = A052330(A003188(n)); \\ Antti Karttunen, Apr 13 2018
default(parisizemax,2^31); up_to_e = 16; up_to = (1 + 2^up_to_e); v050376 = vector(2+up_to_e); A050376(n) = v050376[n]; ispow2(n) = (n && !bitand(n,n-1)); i = 0; for(n=1,oo,if(ispow2(isprimepower(n)), i++; v050376[i] = n); if(i == 2+up_to_e,break)); A052330(n) = { my(p=1,i=1); while(n>0, if(n%2, p *= A050376(i)); i++; n >>= 1); (p); }; A053669(n) = forprime(p=2, , if (n % p, return(p))); \\ From A053669 v303760 = vector(up_to); m_inverses = Map(); prev=1; for(n=1,up_to,fordiv(prev,d,if(!mapisdefined(m_inverses,d),v303760[n] = d;mapput(m_inverses,d,n);break)); if(!v303760[n], apu = prev; while(mapisdefined(m_inverses,try = prev*A053669(apu)), apu *= A053669(apu)); v303760[n] = try; mapput(m_inverses,try,n)); prev = v303760[n]); A303760(n) = v303760[n+1]; A048675(n) = { my(f = factor(n)); sum(k=1, #f~, f[k, 2]*2^primepi(f[k, 1]))/2; }; A303771(n) = A052330(A048675(A303760(n)));
After a(3) = 2, "10" in binary, there are no submasks that wouldn't have been used, so one selects from supermasks h_i = "110" (6), "111" (7), "1010" (10), "1011" (11), "1110" (14), "1111" (15), "10010" (18), "10011" (19), etc. that one for which A054429(h_i) is minimized, which happens to be at 6 (as A054429(6) = 5, but A054429(7) = 4, and for n >= 8, A054429(n) >= 8), thus a(4) = 7. After a(4) = 7, "111" in binary, the submasks "1", "10", and "11" (1-3) are already present in sequence, while submasks "100", "101", "110" (4-6) are not present, and because A054429 is minimized on these three at 6, a(5) = 6.
allocatemem(2^30); default(parisizemax,2^31); up_to = (2^17)+2; A054429(n) = ((3<<#binary(n\2))-n-1); find_minimal_submask_for_A054429(n,m_inverses) = { my(minval=0,minmask=0); for(m=1,n,if((bitor(m,n)==n) && !mapisdefined(m_inverses,m) && (!minval || (A054429(m) < minval)), minval = A054429(m); minmask = m)); (minmask); }; find_minimal_supermask_for_A054429(n,m_inverses) = { my(minval=0,minmask=0); for(m=1,(1<<(1+#binary(n)))-1,if((bitand(m,n)==n) && !mapisdefined(m_inverses,m) && (!minval || (A054429(m) < minval)), minval = A054429(m); minmask = m)); (minmask); }; v304083 = vector(up_to); m304084 = Map(); w=1; for(n=1,up_to,s = Set([]); if((submask = find_minimal_submask_for_A054429(w,m304084)), w = submask, w = find_minimal_supermask_for_A054429(w,m304084)); v304083[n] = w; mapput(m304084,w,n)); A304083(n) = if(!n,n,v304083[n]); A304084(n) = if(!n,n,mapget(m304084,n));
Comments