login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A262057 Array based on the Stanley sequence S(0), A005836, by antidiagonals. 3

%I #54 Jan 06 2024 12:07:00

%S 0,2,1,7,5,3,21,8,6,4,23,22,16,11,9,64,26,24,17,14,10,69,65,50,25,19,

%T 15,12,71,70,67,53,48,20,18,13,193,80,78,68,59,49,34,29,27,207,194,

%U 152,79,73,62,51,35,32,28,209,208,196,161,150,74,63,52,43,33,30

%N Array based on the Stanley sequence S(0), A005836, by antidiagonals.

%C This array is similar to a dispersion in that the first column is the minimal nonnegative sequence that contains no 3-term arithmetic progression, and each next column is the minimal sequence consisting of the numbers rejected from the previous column that contains no 3-term arithmetic progression.

%C A100480(n) describes which column n is sorted into.

%C The columns of the array form the greedy partition of the nonnegative integers into sequences that contain no 3-term arithmetic progression. - _Robert Israel_, Feb 03 2016

%H Max Barrentine and Robert Israel, <a href="/A262057/b262057.txt">Table of n, a(n) for n = 1..10011</a> (first 141 antidiagonals, flattened; n=1..77 from Max Barrentine)

%F A006997(A(n, k)) = k - 1. - _Rémy Sigrist_, Jan 06 2024

%e From the top-left corner, this array starts:

%e 0 2 7 21 23 64

%e 1 5 8 22 26 65

%e 3 6 16 24 50 67

%e 4 11 17 25 53 68

%e 9 14 19 48 59 73

%e 10 15 20 49 62 74

%p M:= 20: # to get the first M antidiagonals

%p for i from 1 to M do B[i]:= {}: F[i]:= {}: od:

%p countdowns:= Vector(M,j->M+1-j):

%p for x from 0 while max(countdowns) > 0 do

%p for i from 1 do

%p if not member(x, F[i]) then

%p F[i]:= F[i] union map(y -> 2*x-y, B[i]);

%p B[i]:= B[i] union {x};

%p countdowns[i]:= countdowns[i] - 1;

%p break

%p fi

%p od;

%p od:

%p seq(seq(B[n+1-i][i], i=1..n),n=1..M); # _Robert Israel_, Feb 03 2016

%o (MATLAB)

%o function A = A262057( M, N )

%o % to get first M antidiagonals using x up to N

%o B = cell(1,M);

%o F = zeros(M,N+1);

%o countdowns = [M:-1:1];

%o for x=0:N

%o if max(countdowns) == 0

%o break

%o end

%o for i=1:M

%o if F(i,x+1) == 0

%o newforb = 2*x - B{i};

%o newforb = newforb(newforb <= N & newforb >= 1);

%o F(i,newforb+1) = 1;

%o B{i}(end+1) = x;

%o countdowns(i) = countdowns(i)-1;

%o break

%o end

%o end

%o end

%o if max(countdowns) > 0

%o [~,jmax] = max(countdowns);

%o jmax = jmax(1);

%o error ('Need larger N: B{%d} has only %d elements',jmax,numel(B{jmax}));

%o end

%o A = zeros(1,M*(M+1)/2);

%o k = 0;

%o for n=1:M

%o for i=1:n

%o k=k+1;

%o A(k) = B{n+1-i}(i);

%o end

%o end

%o end % _Robert Israel_, Feb 03 2016

%Y First column is A005836.

%Y First row is A265316.

%Y Cf. A006997, A074940, A100480.

%K nonn,tabl

%O 1,2

%A _Max Barrentine_, Nov 29 2015

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified July 14 16:35 EDT 2024. Contains 374322 sequences. (Running on oeis4.)