A118320 Duplicate of A108918.
1, 3, 2, 5, 7, 6, 4, 9, 11, 10, 13, 15, 14, 12, 8, 17, 19, 18, 21, 23, 22, 20, 25, 27, 26, 29, 31, 30, 28, 24, 16, 33, 35, 34, 37, 39, 38, 36, 41, 43, 42, 45, 47, 46, 44, 40, 49, 51
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.
a(11)=1 because we have [7,3,1]. G.f. = 1 + x + x^3 + x^4 + x^7 + x^8 + x^10 + x^11 + x^15 + x^16 + x^18 + ... From _Omar E. Pol_, Nov 30 2009: (Start) The sequence, displayed as irregular triangle, in which rows length are powers of 2, begins: 1; 1,0; 1,1,0,0; 1,1,0,1,1,0,0,0; 1,1,0,1,1,0,0,1,1,0,1,1,0,0,0,0; 1,1,0,1,1,0,0,1,1,0,1,1,0,0,0,1,1,0,1,1,0,0,1,1,0,1,1,0,0,0,0,0; 1,1,0,1,1,0,0,1,1,0,1,1,0,0,0,1,1,0,1,1,0,0,1,1,0,1,1,0,0,0,0,1,1,0,1,1,0,0,1,1,0,1,1,0,0,0,1,1,0,1,1,0,0,1,1,0,1,1,0,0,0,0,0,0; (End)
a079559 = p $ tail a000225_list where p _ 0 = 1 p (k:ks) m = if m < k then 0 else p ks (m - k) + p ks m -- Reinhard Zumkeller, Dec 11 2011
a079559_list = 1 : f [1] where f xs = ys ++ f ys where ys = init xs ++ [1] ++ tail xs ++ [0] -- Reinhard Zumkeller, May 05 2015
g:=product(1+x^(2^n-1),n=1..15): gser:=series(g,x=0,110): seq(coeff(gser,x,n),n=0..104); # Emeric Deutsch, Apr 06 2006 d := n -> if n=1 then 1 else A046699(n)-A046699(n-1) fi; # Frank Ruskey and Chris Deugau (deugaucj(AT)uvic.ca)
row[1] = {1}; row[2] = {1, 0}; row[n_] := row[n] = row[n-1] /. 1 -> Sequence[1, 1, 0]; Table[row[n], {n, 1, 7}] // Flatten (* Jean-François Alcover, Jul 30 2012, after Omar E. Pol *) CoefficientList[ Series[ Product[1 + x^(2^n - 1), {n, 6}], {x, 0, 104}], x] (* or *) Nest[ Flatten[# /. {0 -> {0}, 1 -> {1, 1, 0}}] &, {1}, 6] (* Robert G. Wilson v, Sep 08 2014 *)
w="1,";for(i=1,5,print1(w=concat([w,w,"0,"])))
A079559(n,w=[1])=until(n<#w=concat([w,w,[0]]),);w[n+1] \\ M. F. Hasler, Dec 19 2007
{a(n) = if( n<0, 0, polcoeff( prod(k=1, #binary(n+1), 1 + x^(2^k-1), 1 + x * O(x^n)), n))} /* Michael Somos, Aug 03 2009 */
def a053644(n): return 0 if n==0 else 2**(len(bin(n)[2:]) - 1) def a043545(n): x=bin(n)[2:] return int(max(x)) - int(min(x)) l=[1] for n in range(1, 101): l+=[a043545(n + 1)*l[n + 1 - a053644(n + 1)], ] print(l) # Indranil Ghosh, Jun 11 2017
a(4) = 2 because 4+2 (110) has two 1's, but 4+1 (101) has more than one 1. Conjecture (Joerg Arndt): a(n) is the number of bits in the binary words of sequence A108918 ......A108918.A108918..n..=..n.=.(sum.of.term.2^k-1) ........00001.1.....00001.=..1.=..1 ........00011.2.....00010.=..2.=..1.+.1 ........00010.1.....00011.=..3.=..3 ........00101.2.....00100.=..4.=..3.+.1 ........00111.3.....00101.=..5.=..3.+.1.+.1 ........00110.2.....00110.=..6.=..3.+.3 ........00100.1.....00111.=..7.=..7 ........01001.2.....01000.=..8.=..7.+.1 ........01011.3.....01001.=..9.=..7.+.1.+.1 ........01010.2.....01010.=.10.=..7.+.3 ........01101.3.....01011.=.11.=..7.+.3.+.1 ........01111.4.....01100.=.12.=..7.+.3.+.1.+.1 ........01110.3.....01101.=.13.=..7.+.3.+.3 ........01100.2.....01110.=.14.=..7.+.7 ........01000.1.....01111.=.15.=.15
hb:= n-> `if`(n=1, 0, 1+hb(iquo (n, 2))): a:= proc(n) local m, t; m:= n; for t from 0 while m>0 do m:= m - (2^(hb(m+1))-1) od; t end: seq(a(n), n=1..100); # Alois P. Heinz, Jan 22 2011
hb[n_] := If[n==1, 0, 1+hb[Quotient[n, 2]]]; a[n_] := Module[{m=n, t}, For[t=0, m>0, t++, m = m - (2^(hb[m+1])-1)]; t]; Array[a, 100] (* Jean-François Alcover, Oct 31 2020, after Alois P. Heinz *)
A100661(n)= { /* method: repeatedly subtract Mersenne numbers */ local(m, ct); if ( n<=1, return(n) ); m = 1; while ( n>m, m<<=1 ); m -= 1; while ( m>n, m>>=1 ); /* here m=2^k-1 and m<=n */ ct = 0; while ( n, while (m<=n, n-=m; ct+=1); m>>=1 ); return( ct ); } vector(100,n,A100661(n)) /* show terms */ /* Joerg Arndt, Jan 22 2011 */
TInverse(v)= { local(l, w, used, start, x); l = length(v); w = vector(l); used = vector(l); start = 1; for (i = 1, l, while (start <= l && used[start], start++); x = start; for (j = 2, v[i], x++; while (x <= l && used[x], x++)); if (x > l, return (vector(i - 1, k, w[k])) , /* else */ w[i] = x; used[x] = 1 ) ); return(w); } PInverse(v)= { local(l, w); l = length(v); w = vector(l); for (i = 1, l, if (v[i] <= l, w[v[i]] = i)); return(w); } T(v)= { local(l, w, c); l = length(v); w = vector(l); for (n = 1, l, if (v[n], c = 0; for (m = 1, n - 1, if (v[m] < v[n], c++)); w[n] = v[n] - c , /* else */ return (vector(n - 1, i, w[i])) ) ); return(w); } Q(v)=T(PInverse(TInverse(v))); /* compute terms: */ v = vector(150); for (n = 1, 150, m = n; x = 1; while (!(m%2), m\=2; x *= 2); v[n] = x); Q(v)
A100661 = lambda n: next(k for k in PositiveIntegers() if (n+k).digits(base=2).count(1) <= k) # D. S. McNeil, Jan 23 2011
4 is the highest power of 2 dividing 12. Those positive integers not occurring among the first 11 terms of the sequence form the sequence 11, 12, 13, 14, 16,... Now 14 is the 4th of these integers, so a(12) = 14.
A118319 := proc(nmin) local a,anxt,i,n ; a := [1] ; while nops(a) < nmin do n := nops(a)+1 ; i := 2^A007814(n); anxt := 0 ; while i > 0 do anxt := anxt+1 ; while anxt in a do anxt := anxt+1 ; od ; i := i-1; od ; a := [op(a),anxt] ; od; a ; end: A118319(80) ; # R. J. Mathar, Sep 06 2007 a := n -> n + 2^padic[ordp](n, 2) - add(convert(n, base, 2)): seq(a(n), n = 1..72); # Peter Luschny, Mar 08 2025
a[1] := 1; a[n_] := a[n] = Part[ Complement[ Range[2 n], Table[a[i], {i, n - 1}]], 2^IntegerExponent[n, 2]]; Array[a, 100] (* Birkas Gyorgy, Jul 09 2012 *)
a(n) = n + 1<Kevin Ryde, Mar 02 2025
Triangle starts 1; 2, 1; 3; 4, 2, 1; 5; 6, 3; 7; 8, 4, 2, 1; 9; 10, 5; 11; 12, 6, 3; 13;
T:= proc(n) local m,l; m:=n; l:= m; while irem(m, 2, 'm')=0 do l:=l,m od: l end: seq(T(n), n=1..40); # Alois P. Heinz, Oct 09 2015
Flatten[Function[n, NestWhile[Append[#, Last[#]/2] &, {n}, EvenQ[Last[#]] &]][#] & /@ Range[20]] (* Birkas Gyorgy, Apr 13 2011 *)
Example for word length 5: no: word transition 00: ..... .1... 3 01: 1.... 1.... 4 02: 11... .1... 3 03: 111.. ..1.. 2 04: 1111. ...1. 1 05: 11111 ....1 0 <--= sequence starts 06: 111.1 ...1. 1 07: 11..1 ..1.. 2 08: 11.11 ...1. 1 09: 11.1. ....1 0 10: 1..1. .1... 3 11: 1..11 ....1 0 12: 1...1 ...1. 1 13: 1.1.1 ..1.. 2 14: 1.111 ...1. 1 15: 1.11. ....1 0 16: 1.1.. ...1. 1 17: ..1.. 1.... 4 18: ..11. ...1. 1 19: ..111 ....1 0 20: ..1.1 ...1. 1 21: ....1 ..1.. 2 22: ...11 ...1. 1 23: ...1. ....1 0 24: .1.1. .1... 3 25: .1.11 ....1 0 26: .1..1 ...1. 1 27: .11.1 ..1.. 2 28: .1111 ...1. 1 29: .111. ....1 0 30: .11.. ...1. 1 31: .1... ..1.. 2 Append first few words to obtain Gray code for word length 5: 00: ..... .1... 01: 1.... 1.... 02: 11... .1... 03: 111.. ..1.. 04: 1111. ...1.
For n = 1, 2, 3, the sets B_n, their subsets (the column under B_n), binary characteristic words (column bin.) and corresponding integers (column dec.) are: B_1 = {c} bin. dec. | B_2 = {b, c} bin. dec. | B_3 = {a, b, c} bin. dec. {} 0 0 | {} 00 0 | {} 000 0 {c} 1 1 | {b} 10 2 | {a} 100 4 | {b, c} 11 3 | {a, b} 110 6 | {c} 01 1 | {a, b, c} 111 7 | {a, c} 101 5 | {b} 010 2 | {b, c} 011 3 | {c} 001 1 As seen, when B = {a, b, c}, its subsets {}, {a}, {a, b}, {a, b, c}, {a, c}, {b}, {b, c}, {c} are in lexicographic order, the corresponding binary words of length 3 are 000, 100, 110, 111, 101, 010, 011, 001, and so row(3) = 0, 4, 6, 7, 5, 2, 3, 1. Triangle T(n,k) begins: k=0 1 2 3 4 5 6 7 ... n=0: 0; n=1: 0, 1; n=2: 0, 2, 3, 1; n=3: 0, 4, 6, 7, 5, 2, 3, 1; n=4: 0, 8, 12, 14, 15, 13, 10, 11, 9, 4, 6, 7, 5, 2, 3, 1; n=5: 0, 16, 24, 28, 30, 31, 29, 26, 27, 25, 20, 22, 23, 21, 18, 19, 17, 8, 12, 14, 15, 13, 10, 11, 9, 4, 6, 7, 5, 2, 3, 1, ...
(* computing row(n) *) n = 5; Array[row, 2^n]; row[0] = 0; row[1] = 1; len = 2; For[i = 2, i <= n, i++, For[j = 1, j < len, j++, row[j + len] = row[j]]; For[j = len, j > 0, j--, row[j] = row[j - 1] + len]; len = len*2; ];
Comments