cp's OEIS Frontend

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.

A048793 List giving all subsets of natural numbers arranged in standard statistical (or Yates) order.

This page as a plain text file.
%I A048793 #33 Feb 01 2023 14:34:08
%S A048793 0,1,2,1,2,3,1,3,2,3,1,2,3,4,1,4,2,4,1,2,4,3,4,1,3,4,2,3,4,1,2,3,4,5,
%T A048793 1,5,2,5,1,2,5,3,5,1,3,5,2,3,5,1,2,3,5,4,5,1,4,5,2,4,5,1,2,4,5,3,4,5,
%U A048793 1,3,4,5,2,3,4,5,1,2,3,4,5,6,1,6,2,6,1,2,6,3,6,1,3,6,2,3,6,1,2,3,6,4,6,1,4
%N A048793 List giving all subsets of natural numbers arranged in standard statistical (or Yates) order.
%C A048793 For n>0: first occurrence of n in row 2^(n-1), and when the table is seen as a flattened list at position n*2^(n-1)+1, cf. A005183. - _Reinhard Zumkeller_, Nov 16 2013
%C A048793 Row n lists the positions of 1's in the reversed binary expansion of n. Compare to triangles A112798 and A213925. - _Gus Wiseman_, Jul 22 2019
%D A048793 S. Hedayat, N. J. A. Sloane and J. Stufken, Orthogonal Arrays, Springer-Verlag, NY, 1999, p. 249.
%H A048793 Reinhard Zumkeller, <a href="/A048793/b048793.txt">Rows n = 0..1000 of triangle, flattened</a>
%F A048793 Constructed recursively: subsets that include n are obtained by appending n to all earlier subsets.
%e A048793 From _Gus Wiseman_, Jul 22 2019: (Start)
%e A048793 Triangle begins:
%e A048793   {}
%e A048793   1
%e A048793   2
%e A048793   1  2
%e A048793   3
%e A048793   1  3
%e A048793   2  3
%e A048793   1  2  3
%e A048793   4
%e A048793   1  4
%e A048793   2  4
%e A048793   1  2  4
%e A048793   3  4
%e A048793   1  3  4
%e A048793   2  3  4
%e A048793   1  2  3  4
%e A048793   5
%e A048793   1  5
%e A048793   2  5
%e A048793   1  2  5
%e A048793   3  5
%e A048793 (End)
%p A048793 T:= proc(n) local i, l, m; l:= NULL; m:= n;
%p A048793       if n=0 then return 0 fi; for i while m>0 do
%p A048793       if irem(m, 2, 'm')=1 then l:=l, i fi od; l
%p A048793     end:
%p A048793 seq(T(n), n=0..50);  # _Alois P. Heinz_, Sep 06 2014
%t A048793 s[0] = {{}}; s[n_] := s[n] = Join[s[n - 1], Append[#, n]& /@ s[n - 1]]; Join[{0}, Flatten[s[6]]] (* _Jean-François Alcover_, May 24 2012 *)
%t A048793 Table[Join@@Position[Reverse[IntegerDigits[n,2]],1],{n,30}] (* _Gus Wiseman_, Jul 22 2019 *)
%o A048793 (C)
%o A048793 #include <stdio.h>
%o A048793 #include <stdlib.h>
%o A048793 #define USAGE "Usage: 'A048793 num' where num is the largest number to use creating sets.\n"
%o A048793 #define MAX_NUM 10
%o A048793 #define MAX_ROW 1024
%o A048793 int main(int argc, char *argv[]) {
%o A048793   unsigned short a[MAX_ROW][MAX_NUM]; signed short old_row, new_row, i, j, end;
%o A048793   if (argc < 2) { fprintf(stderr, USAGE); return EXIT_FAILURE; }
%o A048793   end = atoi(argv[1]); end = (end > MAX_NUM) ? MAX_NUM: end;
%o A048793   for (i = 0; i < MAX_ROW; i++) for ( j = 0; j < MAX_NUM; j++) a[i][j] = 0;
%o A048793   a[1][0] = 1; new_row = 2;
%o A048793   for (i = 2; i <= end; i++) {
%o A048793     a[new_row++ ][0] = i;
%o A048793     for (old_row = 1; a[old_row][0] != i; old_row++) {
%o A048793       for (j = 0; a[old_row][j] != 0; j++) { a[new_row][j] = a[old_row][j]; }
%o A048793       a[new_row++ ][j] = i;
%o A048793     }
%o A048793   }
%o A048793   fprintf(stdout, "Values: 0");
%o A048793   for (i = 1; a[i][0] != 0; i++) for (j = 0; a[i][j] != 0; j++) fprintf(stdout, ",%d", a[i][j]);
%o A048793   fprintf(stdout, "\n"); return EXIT_SUCCESS
%o A048793 }
%o A048793 (Haskell)
%o A048793 a048793 n k = a048793_tabf !! n !! k
%o A048793 a048793_row n = a048793_tabf !! n
%o A048793 a048793_tabf = [0] : [1] : f [[1]] where
%o A048793    f xss = yss ++ f (xss ++ yss) where
%o A048793      yss = [y] : map (++ [y]) xss
%o A048793      y = last (last xss) + 1
%o A048793 -- _Reinhard Zumkeller_, Nov 16 2013
%Y A048793 Cf. A048794.
%Y A048793 Row lengths are A000120.
%Y A048793 First column is A001511.
%Y A048793 Heinz numbers of rows are A019565.
%Y A048793 Row sums are A029931.
%Y A048793 Reversing rows gives A272020.
%Y A048793 Subtracting 1 from each term gives A133457; subtracting 1 and reversing rows gives A272011.
%Y A048793 Indices of relatively prime rows are A291166 (see also A326674); arithmetic progressions are A295235; rows with integer average are A326669 (see also A326699/A326700); pairwise coprime rows are A326675.
%Y A048793 Cf. A035327, A070939.
%K A048793 nonn,tabf,easy,nice
%O A048793 0,3
%A A048793 _N. J. A. Sloane_
%E A048793 More terms from Larry Reeves (larryr(AT)acm.org), Apr 11 2000