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.

Showing 1-10 of 11 results. Next

A236269 First differences of Stanley sequence S(0,4) (A005487).

Original entry on oeis.org

4, 1, 2, 4, 1, 4, 7, 3, 5, 2, 4, 1, 6, 5, 7, 17, 5, 2, 5, 10, 4, 7, 18, 4, 3, 5, 7, 26, 19, 9, 6, 17, 1, 5, 1, 11, 9, 12, 10, 7, 8, 3, 15, 6, 2, 3, 6, 18, 48, 7, 5, 25, 12, 21, 11, 4, 21, 2, 6, 5, 50, 5, 21, 18, 30, 1, 6, 5, 4, 6, 4, 1, 2, 20, 10, 4, 24, 3, 13, 5
Offset: 1

Views

Author

Ralf Stephan, Jan 21 2014

Keywords

Comments

Also first differences of Stanley sequence S(1,5) (A033158).
While there are conjectures about formulas for S(0,m), m=1,2,3,6,9... (see A093682), m=4 is the first case where the first differences look almost random.
Records are 4, 7, 17, 18, 26, 48, 50, 55, 76, 87, 92, 93, 165, 175,...
Positions of records are 1, 7, 16, 23, 28, 49, 61, 81, 83, 101, 147, 165, 185, 250, 400,...
Positions where a(n)=1: 2, 5, 12, 33, 35, 66, 72, 94, 125, 160, 189, 288, 307, 327,...

Programs

  • PARI
    NAP(sv,N)=local(v,vv,m,k,l,sl,vvl);sl=length(sv);vvl=min(N*N,10^5);v=vector(N);vv=vector(vvl);for(k=1,sl,v[k]=sv[k];for(l=1,k-1,vv[2*v[k]-v[l]]=1));m=v[sl]+1;for(k=sl+1,N,while(m<=vvl&&vv[m],m=m+1);if(m>vvl,return(v));for(l=1,k-1,sl=2*m-v[l];if(sl<=vvl,vv[sl]=1));vv[m]=1;v[k]=m);v
    S04(n)=N=1000;NAP([0,4],N)[n]
    a(n)=S04(n+1)-S04(n)

A229037 The "forest fire": sequence of positive integers where each is chosen to be as small as possible subject to the condition that no three terms a(j), a(j+k), a(j+2k) (for any j and k) form an arithmetic progression.

Original entry on oeis.org

1, 1, 2, 1, 1, 2, 2, 4, 4, 1, 1, 2, 1, 1, 2, 2, 4, 4, 2, 4, 4, 5, 5, 8, 5, 5, 9, 1, 1, 2, 1, 1, 2, 2, 4, 4, 1, 1, 2, 1, 1, 2, 2, 4, 4, 2, 4, 4, 5, 5, 8, 5, 5, 9, 9, 4, 4, 5, 5, 10, 5, 5, 10, 2, 10, 13, 11, 10, 8, 11, 13, 10, 12, 10, 10, 12, 10, 11, 14, 20, 13
Offset: 1

Views

Author

Jack W Grahl, Sep 11 2013

Keywords

Comments

Added name "forest fire" to make it easier to locate this sequence. - N. J. A. Sloane, Sep 03 2019
This sequence and A235383 and A235265 were winners in the best new sequence contest held at the OEIS Foundation booth at the 2014 AMS/MAA Joint Mathematics Meetings. - T. D. Noe, Jan 20 2014
See A236246 for indices n such that a(n)=1. - M. F. Hasler, Jan 20 2014
See A241673 for indices n such that a(n)=2^k. - Reinhard Zumkeller, Apr 26 2014
The graph (for up to n = 10000) has an eerie similarity (why?) to the distribution of rising smoke particles subjected to a lateral wind, and where the particles emanate from randomly distributed burning areas in a fire in a forest or field. - Daniel Forgues, Jan 21 2014
The graph (up to n = 100000) appears to have a fractal structure. The dense areas are not random but seem to repeat, approximately doubling in width and height each time. - Daniel Forgues, Jan 21 2014
a(A241752(n)) = n and a(m) != n for m < A241752(n). - Reinhard Zumkeller, Apr 28 2014
The indices n such that a(n) = 1 are given by A236313 (relative spacing) up to 19 terms, and A003278 (directly) up to 20 terms. If just placing ones, the 21st 1 would be n=91. The sequence A003278 fails at n=91 because the numbers filling the gaps create an arithmetic progression with a(27)=9, a(59)=5 and a(91)=1. Additionally, if you look at indices n starting at the first instance of 4 or 5, A003278/A236313 provide possible indices for a(n)=4 or a(n)=5, with some indexes instead filled by numbers < (4,5). A003278/A236313 also fail to predict indices for a(n)=4 or a(n)=5 by the ~20th term. - Daniel Putt, Sep 29 2022

Crossrefs

Cf. A094870, A362942 (partial sums).
For a variant see A309890.
A selection of sequences related to "no three-term arithmetic progression": A003002, A003003, A003278, A004793, A005047, A005487, A033157, A065825, A092482, A093678, A093679, A093680, A093681, A093682, A094870, A101884, A101886, A101888, A140577, A185256, A208746, A229037.

Programs

  • Haskell
    import Data.IntMap (empty, (!), insert)
    a229037 n = a229037_list !! (n-1)
    a229037_list = f 0 empty  where
       f i m = y : f (i + 1) (insert (i + 1) y m) where
         y = head [z | z <- [1..],
                       all (\k -> z + m ! (i - k) /= 2 * m ! (i - k `div` 2))
                           [1, 3 .. i - 1]]
    -- Reinhard Zumkeller, Apr 26 2014
    
  • Mathematica
    a[1] = 1; a[n_] := a[n] = Block[{z = 1}, While[Catch[ Do[If[z == 2*a[n-k] - a[n-2*k], Throw@True], {k, Floor[(n-1)/2]}]; False], z++]; z]; a /@ Range[100] (* Giovanni Resta, Jan 01 2014 *)
  • PARI
    step(v)=my(bad=List(),n=#v+1,t); for(d=1,#v\2,t=2*v[n-d]-v[n-2*d]; if(t>0, listput(bad,t))); bad=Set(bad); for(i=1,#bad, if(bad[i]!=i, return(i))); #bad+1
    first(n)=my(v=List([1])); while(n--, listput(v, step(v))); Vec(v) \\ Charles R Greathouse IV, Jan 21 2014
    
  • Python
    A229037_list = []
    for n in range(10**6):
        i, j, b = 1, 1, set()
        while n-2*i >= 0:
            b.add(2*A229037_list[n-i]-A229037_list[n-2*i])
            i += 1
            while j in b:
                b.remove(j)
                j += 1
        A229037_list.append(j) # Chai Wah Wu, Dec 21 2014

Formula

a(n) <= (n+1)/2. - Charles R Greathouse IV, Jan 21 2014

A003002 Size of the largest subset of the numbers [1...n] which does not contain a 3-term arithmetic progression.

Original entry on oeis.org

0, 1, 2, 2, 3, 4, 4, 4, 4, 5, 5, 6, 6, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 11, 11, 11, 11, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 22, 22, 22, 22
Offset: 0

Views

Author

Keywords

Comments

"Sequences containing no 3-term arithmetic progressions" is another phrase people may be searching for.
a(n) = size of largest subset of [1..n] such that no term is the average of any two others. These are also called non-averaging sets, or 3-free sequences. - N. J. A. Sloane, Mar 01 2012
More terms of this sequence can be found directly from A065825, because A003002(n) (this sequence) = the integer k such that A065825(k) <= n < A065825(k+1). - Shreevatsa R, Oct 18 2009

Examples

			Examples from Dybizbanski (2012) (includes earlier examples found by other people):
n, a(n), example of an optimal subset:
0, 0, []
1, 1, [1]
2, 2, [1, 2]
4, 3, [1, 2, 4]
5, 4, [1, 2, 4, 5]
9, 5, [1, 2, 4, 8, 9]
11, 6, [1, 2, 4, 5, 10, 11]
13, 7, [1, 2, 4, 5, 10, 11, 13]
14, 8, [1, 2, 4, 5, 10, 11, 13, 14]
20, 9, [1, 2, 6, 7, 9, 14, 15, 18, 20]
24, 10, [1, 2, 5, 7, 11, 16, 18, 19, 23, 24]
26, 11, [1, 2, 5, 7, 11, 16, 18, 19, 23, 24, 26]
30, 12, [1, 3, 4, 8, 9, 11, 20, 22, 23, 27, 28, 30]
32, 13, [1, 2, 4, 8, 9, 11, 19, 22, 23, 26, 28, 31, 32]
36, 14, [1, 2, 4, 8, 9, 13, 21, 23, 26, 27, 30, 32, 35, 36]
40, 15, [1, 2, 4, 5, 10, 11, 13, 14, 28, 29, 31, 32, 37, 38, 40]
41, 16, [1, 2, 4, 5, 10, 11, 13, 14, 28, 29, 31, 32, 37, 38, 40, 41]
51, 17, [1, 2, 4, 5, 10, 13, 14, 17, 31, 35, 37, 38, 40, 46, 47, 50, 51]
54, 18, [1, 2, 5, 6, 12, 14, 15, 17, 21, 31, 38, 39, 42, 43, 49, 51, 52, 54]
58, 19, [1, 2, 5, 6, 12, 14, 15, 17, 21, 31, 38, 39, 42, 43, 49, 51, 52, 54, 58]
63, 20, [1, 2, 5, 7, 11, 16, 18, 19, 24, 26, 38, 39, 42, 44, 48, 53, 55, 56, 61, 63]
71, 21, [1, 2, 5, 7, 10, 17, 20, 22, 26, 31, 41, 46, 48, 49, 53, 54, 63, 64, 68, 69, 71]
74, 22, [1, 2, 7, 9, 10, 14, 20, 22, 23, 25, 29, 46, 50, 52, 53, 55, 61, 65, 66, 68, 73, 74]
82, 23, [1, 2, 4, 8, 9, 11, 19, 22, 23, 26, 28, 31, 49, 57, 59, 62, 63, 66, 68, 71, 78, 81, 82]
		

References

  • H. L. Abbott, On a conjecture of Erdos and Straus on non-averaging sets of integers, Proc. 5th British Combinatorial Conference, 1975, pp. 1-4.
  • Bloom, T. F. (2014). Quantitative results in arithmetic combinatorics (Doctoral dissertation, University of Bristol).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • E. G. Straus, Nonaveraging sets. In Combinatorics (Proc. Sympos. Pure Math., Vol. XIX, Univ. California, Los Angeles, Calif., 1968), pp. 215-222. Amer. Math. Soc., Providence, R.I., 1971. MR0316255 (47 #4803)
  • T. Tao and V. Vu, Additive Combinatorics, Problem 10.1.3.

Crossrefs

The classical lower bound is A104406; A229037 gives a "greedy" lower bound. - N. J. A. Sloane, Apr 29 2023
Cf. A358062 (diagonal domination number for the n X n queen graph).
A selection of sequences related to "no three-term arithmetic progression": A003002, A003003, A003278, A004793, A005047, A005487, A033157, A065825, A092482, A093678, A093679, A093680, A093681, A093682, A094870, A101884, A101886, A101888, A140577, A185256, A208746, A229037.

Programs

  • Mathematica
    (* Program not suitable to compute a large number of terms *)
    a[n_] := a[n] = For[r = Range[n]; k = n, k >= 1, k--, If[AnyTrue[Subsets[r, {k}], FreeQ[#, {_, a_, _, b_, _, c_, _} /; b - a == c - b] &], Return[k]]];
    Table[Print["a(", n, ") = ", a[n]]; a[n], {n, 1, 25}] (* Jean-François Alcover, Jan 21 2018 *)
  • PARI
    ap3(v)=for(i=1,#v-2, for(j=i+2,#v, my(t=v[i]+v[j]); if(t%2==0 && setsearch(v,t/2), return(1)))); 0
    a(N)=forstep(n=N,2,-1, forvec(v=vector(n,i,[1,N]),if(!ap3(v), return(n)),2)); N \\ Charles R Greathouse IV, Apr 22 2022

Formula

Sanders proves that a(n) << n*(log log n)^5/log n. - Charles R Greathouse IV, Jan 22 2016
Bloom & Sisask prove that a(n) << n/(log n)^c for some c > 1. - Charles R Greathouse IV, Oct 11 2022

Extensions

Extended from 53 terms to 80 terms, using a simple brute-force program with some pruning, by Shreevatsa R, Oct 18 2009
See Dybizbanski (2012) for first 120 terms. - N. J. A. Sloane, Dec 17 2013
Edited by N. J. A. Sloane, Apr 12 2016
a(0)=0 prepended by Alois P. Heinz, May 14 2020

A185256 Stanley Sequence S(0,3).

Original entry on oeis.org

0, 3, 4, 7, 9, 12, 13, 16, 27, 30, 31, 34, 36, 39, 40, 43, 81, 84, 85, 88, 90, 93, 94, 97, 108, 111, 112, 115, 117, 120, 121, 124, 243, 246, 247, 250, 252, 255, 256, 259, 270, 273, 274, 277, 279, 282, 283, 286, 324, 327, 328, 331, 333, 336, 337, 340, 351, 354, 355, 358, 360, 363
Offset: 1

Views

Author

N. J. A. Sloane, Mar 19 2011

Keywords

Comments

Given a finite increasing sequence V = [v_1, ..., v_k] containing no 3-term arithmetic progression, the Stanley Sequence S(V) is obtained by repeatedly appending the smallest term that is greater than the previous term and such that the new sequence also contains no 3-term arithmetic progression.

Examples

			After [0, 3, 4, 7, 9] the next term cannot be 10 or we would have the 3-term A.P. 4,7,10; it cannot be 11 because of 7,9,11; but 12 is OK.
		

References

  • R. K. Guy, Unsolved Problems in Number Theory, E10.

Crossrefs

For other examples of Stanley Sequences see A005487, A005836, A187843, A188052, A188053, A188054, A188055, A188056, A188057.
See also A004793, A033160, A033163.

Programs

  • Maple
    # Stanley Sequences, Discrete Math. vol. 311 (2011), see p. 560
    ss:=proc(s1,M) local n,chvec,swi,p,s2,i,j,t1,mmm; t1:=nops(s1); mmm:=1000;
    s2:=Array(1..t1+M,s1); chvec:=Array(0..mmm);
    for i from 1 to t1 do chvec[s2[i]]:=1; od;
    # Get n-th term:
    for n from t1+1 to t1+M do # do 1
    # Try i as next term:
    for i from s2[n-1]+1 to mmm do # do 2
    swi:=-1;
    # Test against j-th term:
    for j from 1 to n-2 do # do 3
    p:=s2[n-j];
    if 2*p-i < 0 then break; fi;
    if chvec[2*p-i] = 1 then swi:=1; break; fi;
    od; # od 3
    if swi=-1 then s2[n]:=i; chvec[i]:=1; break; fi;
    od; # od 2
    if swi=1 then ERROR("Error, no solution at n = ",n); fi;
    od; # od 1;
    [seq(s2[i],i=1..t1+M)];
    end;
    ss([0,3],80);
  • Mathematica
    ss[s1_, M_] := Module[{n, chvec, swi, p, s2, i, j, t1, mmm}, t1 = Length[s1]; mmm = 1000; s2 = Table[s1, {t1 + M}] // Flatten; chvec = Array[0&, mmm];
    For[i = 1, i <= t1, i++, chvec[[s2[[i]] ]] = 1];
    (* get n-th term *)
    For[n = t1+1, n <= t1 + M, n++,
    (* try i as next term *)
    For[i = s2[[n-1]] + 1, i <= mmm, i++, swi = -1;
    (* test against j-th term *)
    For[j = 1, j <= n-2, j++, p = s2[[n - j]]; If[2*p - i < 0, Break[] ];
    If[chvec[[2*p - i]] == 1, swi = 1; Break[] ] ];
    If[swi == -1, s2[[n]] = i; chvec[[i]] = 1; Break[] ] ];
    If[swi == 1, Print["Error, no solution at n = ", n] ] ];
    Table[s2[[i]], {i, 1, t1 + M}] ];
    ss[{0, 3}, 80] (* Jean-François Alcover, Sep 10 2013, translated from Maple *)
  • PARI
    A185256(n,show=1,L=3,v=[0,3], D=v->v[2..-1]-v[1..-2])={while(#v1||next(2), 2); break)); if(type(show)=="t_VEC", v, v[n])} \\ 2nd (optional) arg: zero = silent, nonzero = verbose, vector (e.g. [] or [1]) = get the whole list [a(1..n)] as return value, else just a(n). - M. F. Hasler, Jan 18 2016

A003003 Size of the largest subset of the numbers [1...n] which doesn't contain a 4-term arithmetic progression.

Original entry on oeis.org

1, 2, 3, 3, 4, 5, 5, 6, 7, 8, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 17, 17, 18, 18, 18, 19, 20, 20, 20, 21, 21, 21, 22, 22, 22, 23, 23, 24, 24, 24, 25, 25, 26, 26, 26, 27, 28, 28, 28, 28, 29, 29, 30, 30, 30, 30, 31, 31, 32, 32, 33, 33, 34, 34, 34
Offset: 1

Views

Author

Keywords

Comments

These subsets have been called 4-free sequences.
Szemeredi's theorem for arithmetic progressions of length 4 asserts that a(n) is o(n) as n -> infinity. - Doron Zeilberger, Mar 26 2008
False g.f. (z^12 + 1 - z^11 - z^10 + z^8 - z^6 + z^5 - z^3 + z)/((z+1)*(z-1)^2) was conjectured by Simon Plouffe in his 1992 dissertation, but in fact is wrong (cf. A136746).

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

A selection of sequences related to "no three-term arithmetic progression": A003002, A003003, A003278, A004793, A005047, A005487, A033157, A065825, A092482, A093678, A093679, A093680, A093681, A093682, A094870, A101884, A101886, A101888, A140577, A185256, A208746, A229037.

Extensions

a(52)-a(72) from Rob Pratt, Jul 09 2015

A101886 Smallest natural number sequence without any length 4 equidistant arithmetic subsequences.

Original entry on oeis.org

1, 2, 3, 5, 6, 7, 9, 10, 11, 14, 15, 16, 18, 19, 20, 22, 24, 27, 28, 29, 31, 32, 35, 36, 37, 39, 41, 42, 43, 47, 48, 50, 51, 53, 55, 58, 60, 61, 63, 65, 66, 68, 70, 71, 72, 77, 78, 80, 82, 85, 86, 87, 89, 90, 91, 94, 95, 96, 98, 99, 100, 102, 103, 104, 107, 109, 110, 111, 114
Offset: 1

Views

Author

Douglas Stones (dssto1(AT)student.monash.edu.au), Dec 20 2004

Keywords

Examples

			4 is out because of 1,2,3,4. 13 is out because of 1,5,9,13.
		

Crossrefs

A selection of sequences related to "no three-term arithmetic progression": A003002, A003003, A003278, A004793, A005047, A005487, A033157, A065825, A092482, A093678, A093679, A093680, A093681, A093682, A094870, A101884, A101886, A101888, A140577, A185256, A208746, A229037.

A101888 Smallest natural number sequence without any length 5 equidistant arithmetic subsequences.

Original entry on oeis.org

1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17, 18, 19, 22, 23, 24, 25, 27, 28, 29, 30, 32, 33, 34, 35, 37, 38, 39, 40, 43, 44, 45, 46, 48, 49, 50, 51, 53, 54, 55, 56, 58, 59, 60, 61, 64, 65, 66, 67, 69, 70, 71, 72, 74, 75, 76, 77, 79, 80, 81, 82, 86, 87, 88, 90, 91, 92, 93, 95
Offset: 1

Views

Author

Douglas Stones (dssto1(AT)student.monash.edu.au), Dec 20 2004

Keywords

Examples

			5 is out because of 1,2,3,4,5. 21 is out because of 1,6,11,16,21.
		

Crossrefs

A selection of sequences related to "no three-term arithmetic progression": A003002, A003003, A003278, A004793, A005047, A005487, A033157, A065825, A092482, A093678, A093679, A093680, A093681, A093682, A094870, A101884, A101886, A101888, A140577, A185256, A208746, A229037.

A033158 Begins with (1, 5); avoids 3-term arithmetic progressions.

Original entry on oeis.org

1, 5, 6, 8, 12, 13, 17, 24, 27, 32, 34, 38, 39, 45, 50, 57, 74, 79, 81, 86, 96, 100, 107, 125, 129, 132, 137, 144, 170, 189, 198, 204, 221, 222, 227, 228, 239, 248, 260, 270, 277, 285, 288, 303, 309, 311, 314, 320, 338, 386, 393, 398, 423, 435, 456, 467, 471, 492, 494, 500
Offset: 1

Views

Author

Keywords

References

  • Iacobescu, F. 'Smarandache Partition Type and Other Sequences.' Bull. Pure Appl. Sci. 16E, 237-240, 1997.
  • H. Ibstedt, A Few Smarandache Sequences, Smarandache Notions Journal, Vol. 8, No. 1-2-3, 1997, 170-183.

Crossrefs

Equals A005487(n-1)+1.

Programs

  • Mathematica
    ss[s1_, M_] := Module[{n, chvec, swi, p, s2, i, j, t1, mmm}, t1 = Length[s1]; mmm = 1000; s2 = Table[s1, {t1 + M}] // Flatten; chvec = Array[0 &, mmm]; For[i = 1, i <= t1, i++, chvec[[s2[[i]]]] = 1]; (* get n-th term *) For[n = t1 + 1, n <= t1 + M, n++, (* try i as next term *) For[i = s2[[n - 1]] + 1, i <= mmm, i++, swi = -1; (* test against j-th term *) For[j = 1, j <= n - 2, j++, p = s2[[n - j]]; If[2*p - i < 0, Break[]]; If[chvec[[2*p - i]] == 1, swi = 1; Break[]]]; If[swi == -1, s2[[n]] = i; chvec[[i]] = 1; Break[]]]; If[swi == 1, Print["Error, no solution at n = ", n]]]; Table[s2[[i]], {i, 1, t1 + M}]]; A033158 = ss[{0, 4}, 80] + 1 (* Jean-François Alcover, Oct 08 2013, after Maple program in A185256 *)

A187843 Stanley Sequence S(0,5).

Original entry on oeis.org

0, 5, 6, 8, 9, 14, 15, 17, 27, 31, 32, 36, 38, 42, 43, 51, 65, 73, 74, 82, 89, 100, 101, 107, 109, 123, 152, 154, 165, 174, 177, 179, 190, 198, 211, 216, 220, 227, 233, 236, 260, 319, 328, 335, 336, 356, 361, 362, 370, 373, 406, 433, 444, 453, 465, 468, 470, 481, 490, 517, 521, 523, 528, 540, 541, 546, 562, 616, 696, 733
Offset: 1

Views

Author

N. J. A. Sloane, Mar 19 2011

Keywords

Comments

See A185256.

Crossrefs

A236697 First differences of A131741.

Original entry on oeis.org

1, 2, 6, 2, 16, 2, 6, 4, 26, 6, 10, 6, 12, 6, 20, 12, 18, 22, 14, 34, 6, 30, 8, 10, 26, 24, 6, 42, 10, 8, 4, 8, 22, 2, 34, 24, 8, 10, 54, 8, 42, 28, 6, 96, 26, 40, 14, 60, 4, 20, 30, 46, 26, 12, 42, 28, 2, 70, 8, 126, 4, 26, 34, 6, 42, 18, 96, 26, 48, 4
Offset: 1

Views

Author

Zak Seidov, Jan 30 2014

Keywords

Comments

Among first 10000 terms, the largest is a(7790) = 17412.

Crossrefs

Formula

a(n) = A131741(n+1) - A131741(n).
Showing 1-10 of 11 results. Next