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-6 of 6 results.

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

A248625 Lexicographically earliest sequence of nonnegative integers such that no triple (a(n),a(n+d),a(n+2d)) is in arithmetic progression, for any d>0, n>=0.

Original entry on oeis.org

0, 0, 1, 0, 0, 1, 1, 3, 3, 0, 0, 1, 0, 0, 1, 1, 3, 3, 1, 3, 3, 4, 4, 7, 4, 4, 8, 0, 0, 1, 0, 0, 1, 1, 3, 3, 0, 0, 1, 0, 0, 1, 1, 3, 3, 1, 3, 3, 4, 4, 7, 4, 4, 8, 8, 3, 3, 4, 4, 9, 4, 4, 9, 1, 9, 12, 10, 9, 7, 10, 12, 9, 11, 9, 9, 11, 9, 10, 13, 19, 12, 0, 0, 1, 0, 0, 1, 1, 3, 3
Offset: 0

Views

Author

M. F. Hasler, Oct 10 2014

Keywords

Comments

The sequence is constructed in the greedy way, appending at each step the least nonnegative integer such that no subsequence of equidistant terms contains an AP.
Every nonnegative integer seems to appear in this sequence - see A248627 for the corresponding indices.
Sequence A229037 is the analog for positive integers (and indices).

Examples

			Start with a(0)=a(1)=0, smallest possible choice and trivially satisfying the constraint since no 3-term subsequence is possible.
Then one must take a(2)=1 since otherwise [0,0,0] would be an AP.
Then one can take again a(3)=a(4)=0, and a(5)=1.
Now appending 0 would yield the AP (0,0,0) by extracting terms with indices 0,3,6; therefore a(6)=1.
Now a(7) cannot be 0 not 1 nor 2 since else a(3)=0, a(5)=1, a(7)=2 would be an AP, therefore a(7)=3 is the least possible choice.
		

Crossrefs

Programs

  • PARI
    [DD(v)=vecextract(v,"^1")-vecextract(v,"^-1"), hasAP(a,m=3)=u=vector(m,i,1);v=vector(m,i,i-1);for(i=1,#a-m+1,for(s=1,(#a-i)\(m-1),#Set(DD(t=vecextract(a,(i)*u+s*v)))==1&&return
    ([i,s,t])))]; a=[]; for(n=1,90,a=concat(a,0);while(hasAP(a),a[#a]++);print1(a[#a]","));a

Formula

a(n) = A229037(n+1)+1.

A248627 Index at which the first n appears in A248625 = least nonnegative sequence with no AP (a(n), a(n+d), a(n+2d)).

Original entry on oeis.org

0, 2, 94, 7, 21, 120, 143, 23, 26, 59, 66, 72, 65, 78, 162, 195, 147, 149, 219, 79, 180, 172, 177, 196, 212, 202, 193, 201, 260, 373, 303, 386, 644, 294, 446, 378, 289, 419, 361, 505, 514, 877, 519, 835, 940, 494, 593, 753, 883, 957, 500, 484, 560, 406, 466
Offset: 0

Views

Author

M. F. Hasler, Oct 10 2014

Keywords

Crossrefs

Formula

a(n) = A241752(n)-1.

A248641 Lexicographically earliest positive sequence which does not contain a 4-term equidistant subsequence (a(n+k*d); k=0,1,2,3) in arithmetic progression.

Original entry on oeis.org

1, 1, 1, 2, 1, 1, 2, 1, 1, 1, 2, 2, 2, 3, 1, 1, 1, 2, 1, 2, 2, 2, 3, 3, 3, 1, 1, 3, 1, 1, 1, 2, 2, 1, 2, 2, 1, 2, 2, 2, 3, 3, 2, 3, 2, 3, 3, 5, 1, 1, 1, 3, 1, 1, 3, 1, 1, 1, 2, 2, 2, 3, 1, 2, 1, 1, 1, 2, 2, 2, 3, 4, 2, 3, 2, 2, 2, 3, 3, 1, 3, 3, 3, 5, 5, 4, 1, 1, 1, 3, 1, 2, 3, 1, 5, 3, 2, 6, 1, 3, 2, 2, 3, 2, 1, 1, 3, 3, 1, 1, 1
Offset: 0

Views

Author

M. F. Hasler, Oct 10 2014

Keywords

Comments

See A248625 for more information, links and examples.
It is a variation of A229037 where 3-term is replaced by 4-term (and with “lead index” 0 instead of 1)

Crossrefs

Programs

  • PARI
    a=[];for(n=1,190,a=concat(a,1);while(hasAP(a,4),a[#a]++));a \\ See A248625 for hasAP().
    
  • SageMath
    cpdef FourFree(int n):
       cdef int i, r, k, s, L1, L2, L3
       cdef list L, Lb
       cdef set b
       L=[1, 1, 1]
       for k in range(3, n):
          b=set()
          for i in range(k):
             if 3*((k-i)/3)==k-i:
                r=(k-i)/3
                L1, L2, L3=L[i], L[i+r], L[i+2*r]
                s=3*(L2-L1)+L1
                if s>0 and L3==2*(L2-L1)+L1:
                   b.add(s)
          if 1 not in b:
             L.append(1)
          else:
             Lb=list(b)
             Lb.sort()
             for t in Lb:
                if t+1 not in b:
                   L.append(t+1)
                   break
       return L
    # Sébastien Palcoux, Aug 28 2019

A248639 Least nonnegative sequence which does not contain a 4-term equidistant subsequence (a(n+k*d); k=0,1,2,3) in arithmetic progression.

Original entry on oeis.org

0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0, 1, 0, 1, 1, 1, 2, 2, 2, 0, 0, 2, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 2, 2, 1, 2, 1, 2, 2, 4, 0, 0, 0, 2, 0, 0, 2, 0, 0, 0, 1, 1, 1, 2, 0, 1, 0, 0, 0, 1, 1, 1, 2, 3, 1, 2, 1, 1, 1, 2, 2, 0, 2, 2, 2, 4, 4, 3, 0, 0, 0, 2, 0, 1, 2, 0, 4, 2, 1, 5, 0, 2, 1, 1, 2, 1, 0, 0, 2, 2, 0, 0, 0, 3, 0, 0, 1, 1, 1, 4, 1, 2, 3, 0, 1, 2, 1, 0, 3, 3, 4, 1, 1, 3
Offset: 0

Views

Author

M. F. Hasler, Oct 10 2014

Keywords

Comments

See A248625 for more information, links and examples.
See A248641 for the "positive integers" variant.

Crossrefs

Programs

  • PARI
    a=[];for(n=1,190,a=concat(a,0);while(hasAP(a,4),a[#a]++));a \\ See A248625 for hasAP().

A248640 Least nonnegative sequence which does not contain a 5-term equidistant subsequence (a(n+k*d); k=0,1,2,3,4) in arithmetic progression.

Original entry on oeis.org

0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0
Offset: 0

Views

Author

M. F. Hasler, Oct 10 2014

Keywords

Comments

See A248625 for more information, links and examples.

Crossrefs

Programs

  • PARI
    a=[];for(n=1,190,a=concat(a,0);while(hasAP(a,5),a[#a]++));a \\ See A248625 for hasAP(). Use concat(a,1) for the "positive integer" variant.
Showing 1-6 of 6 results.