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 20 results. Next

A131391 Positions of positive integers in A131389, minus 1.

Original entry on oeis.org

1, 2, 4, 5, 8, 10, 11, 13, 16, 17, 19, 21, 24, 25, 28, 29, 32, 33, 35, 37, 39, 41, 44, 46, 47, 49, 51, 53, 56, 57, 59, 61, 63, 65, 68, 69, 72, 73, 75, 77, 79, 81, 83, 85, 88, 90, 92, 94, 95, 97, 99, 101, 103, 105, 108, 109, 111, 113, 115, 117, 119, 121, 123, 125, 127, 129
Offset: 1

Views

Author

Clark Kimberling, Jul 06 2007

Keywords

Comments

If A131389 is a permutation of the integers, as conjectured, then A131391 is the complement of A131392.

Examples

			The 5th positive integer to occur in A131391 is 6, which occurs in position 9, so that a(5) = 9 - 1 = 8.
		

Crossrefs

Formula

a(n) = -1 + position of the n-th positive integer in the sequence A131389=(0,1,2,-1,3,4,-2,-3,6,-4,5,...)

A131392 Positions of negative integers in A131389, minus 1.

Original entry on oeis.org

3, 6, 7, 9, 12, 14, 15, 18, 20, 22, 23, 26, 27, 30, 31, 34, 36, 38, 40, 42, 43, 45, 48, 50, 52, 54, 55, 58, 60, 62, 64, 66, 67, 70, 71, 74, 76, 78, 80, 82, 84, 86, 87, 89, 91, 93, 96, 98, 100, 102, 104, 106, 107, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 131, 132
Offset: 1

Views

Author

Clark Kimberling, Jul 06 2007

Keywords

Comments

If A131389 is a permutation of the integers, as conjectured, then A131392 is the complement of A131391.

Examples

			The 5th negative integer to occur in A131391 is -5, which occurs in position 13, so that a(5)=13-1=12.
		

Crossrefs

Formula

a(n) = -1 + position of the n-th negative integer in the sequence A131389=(0,1,2,-1,3,4,-2,-3,6,-4,5,...)

A175007 Positions of nonnegative terms in A131389.

Original entry on oeis.org

1, 2, 3, 5, 6, 9, 11, 12, 14, 17, 18, 20, 22, 25, 26, 29, 30, 33, 34, 36, 38, 40, 42, 45, 47, 48, 50, 52, 54, 57, 58, 60, 62, 64, 66, 69, 70, 73, 74, 76, 78, 80, 82, 84, 86, 89, 91, 93, 95, 96, 98, 100, 102, 104, 106, 109, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128
Offset: 1

Views

Author

Clark Kimberling, Apr 03 2010

Keywords

Comments

Is a(n+1)-a(n) always 1,2 or 3?

Examples

			The first 20 terms of A131389 are
0,1,2,-1,3,4,-2,-3,6,-4,5,7,-5,8,-6,-7,9,10,-8,11.
Positions occupied by nonnegatives are
1,2,3,5,6,9,11,12,14,17,18,20.
		

Crossrefs

A175008 Positions of negative terms in A131389.

Original entry on oeis.org

4, 7, 8, 10, 13, 15, 16, 19, 21, 23, 24, 27, 28, 31, 32, 35, 37, 39, 41, 43, 44, 46, 49, 51, 53, 55, 56, 59, 61, 63, 65, 67, 68, 71, 72, 75, 77, 79, 81, 83, 85, 87, 88, 90, 92, 94, 97, 99, 101, 103, 105, 107, 108, 111, 113, 115, 117, 119, 121, 123, 125, 127, 129, 132, 133
Offset: 1

Views

Author

Clark Kimberling, Apr 03 2010

Keywords

Comments

Is a(n+1)-a(n) always 1,2 or 3?

Examples

			The first 20 terms of A131389 are
0,1,2,-1,3,4,-2,-3,6,-4,5,7,-5,8,-6,-7,9,10,-8,11.
Positions occupied by negatives are
4,7,8,10,13,15,16,19.
		

Crossrefs

A175498 a(1)=1. a(n) = the smallest positive integer not occurring earlier such that a(n)-a(n-1) doesn't equal a(k)-a(k-1) for any k with 2 <= k <= n-1.

Original entry on oeis.org

1, 2, 4, 3, 6, 10, 5, 11, 7, 12, 9, 16, 8, 17, 15, 23, 13, 24, 18, 28, 14, 26, 19, 32, 20, 34, 21, 36, 25, 41, 22, 39, 30, 48, 27, 46, 29, 49, 31, 52, 37, 59, 33, 56, 40, 64, 35, 60, 38, 65, 42, 68, 43, 71, 44, 73, 45, 75, 51, 82, 47, 79, 112, 50, 84, 53, 88, 54, 90, 57, 94, 55, 93, 61, 100, 58, 98, 62, 103, 63, 105, 67
Offset: 1

Views

Author

Leroy Quet, May 31 2010

Keywords

Comments

This sequence is a permutation of the positive integers.
a(n+1)-a(n) = A175499(n).
Conjecture: the lexicographically earliest permutation of {1,2,...n} for which differences of adjacent numbers are all distinct (cf. A131529) has, for n-->infinity, this sequence as its prefix. - Joerg Arndt, May 27 2012

Crossrefs

Programs

  • Haskell
    import Data.List (delete)
    a175498 n = a175498_list !! (n-1)
    a175498_list = 1 : f 1 [2..] [] where
       f x zs ds = g zs where
         g (y:ys) | diff `elem` ds = g ys
                  | otherwise      = y : f y (delete y zs) (diff:ds)
                  where diff = y - x
    -- Reinhard Zumkeller, Apr 25 2015
  • Mathematica
    a[1] = 1; d[1] = 0; k = 1; z = 10000; zz = 120;
    A[k_] := Table[a[i], {i, 1, k}]; diff[k_] := Table[d[i], {i, 1, k}];
    c[k_] := Complement[Range[-z, z], diff[k]];
    T[k_] := -a[k] + Complement[Range[z], A[k]];
    Table[{h = Min[Intersection[c[k], T[k]]], a[k + 1] = a[k] + h, d[k + 1] = h, k = k + 1}, {i, 1, zz}];
    u = Table[a[k], {k, 1, zz}]  (* Clark Kimberling, May 13 2015 *)
  • Python
    A175498_list, l, s, b1, b2 = [1,2], 2, 3, set(), set([1])
    for n in range(3, 10**5):
        i = s
        while True:
            if not (i in b1 or i-l in b2):
                A175498_list.append(i)
                b1.add(i)
                b2.add(i-l)
                l = i
                while s in b1:
                    b1.remove(s)
                    s += 1
                break
            i += 1 # Chai Wah Wu, Dec 15 2014
    

Extensions

More terms from Sean A. Irvine, Jan 27 2011

A257705 Sequence (a(n)) generated by Rule 1 (in Comments) with a(1) = 0 and d(1) = 0.

Original entry on oeis.org

0, 1, 3, 2, 5, 9, 7, 4, 10, 6, 11, 18, 13, 21, 15, 8, 17, 27, 19, 30, 20, 32, 23, 12, 25, 39, 26, 14, 29, 45, 31, 16, 33, 51, 35, 54, 37, 57, 38, 59, 41, 63, 43, 22, 46, 24, 47, 72, 49, 75, 50, 77, 53, 81, 55, 28, 58, 87, 56, 88, 60, 91, 62, 95, 65, 99, 67
Offset: 1

Views

Author

Clark Kimberling, May 12 2015

Keywords

Comments

Rule 1 follows. For k >= 1, let A(k) = {a(1), …, a(k)} and D(k) = {d(1), …, d(k)}. Begin with k = 1 and nonnegative integers a(1) and d(1).
Step 1: If there is an integer h such that 1 - a(k) < h < 0 and h is not in D(k) and a(k) + h is not in A(k), let d(k+1) be the greatest such h, let a(k+1) = a(k) + h, replace k by k + 1, and repeat Step 1; otherwise do Step 2.
Step 2: Let h be the least positive integer not in D(k) such that a(k) + h is not in A(k). Let a(k+1) = a(k) + h and d(k+1) = h. Replace k by k+1 and do Step 1.
Conjecture: if a(1) is an nonnegative integer and d(1) is an integer, then (a(n)) is a permutation of the nonnegative integers (if a(1) = 0) or a permutation of the positive integers (if a(1) > 0). Moreover, (d(n)) is a permutation of the integers if d(1) = 0, or of the nonzero integers if d(1) > 0.
Guide to related sequences:
a(1) d(1) (a(n)) (d(n))
0 0 A257705 A131389 except for initial terms
0 1 A257706 A131389 except for initial terms
0 2 A257876 A131389 except for initial terms
1 1 A257878 A131389 except for initial terms
2 1 A257881 A257880 except for initial terms

Examples

			a(2) = a(1) + d(2) = 0 + 1 = 1;
a(3) = a(2) + d(3) = 1 + 2 = 3;
a(4) = a(3) + d(4) = 3 + (-1) = 2.
		

Crossrefs

Programs

  • Mathematica
    a[1] = 0; d[1] = 0; k = 1; z = 10000; zz = 120;
    A[k_] := Table[a[i], {i, 1, k}]; diff[k_] := Table[d[i], {i, 1, k}];
    c[k_] := Complement[Range[-z, z], diff[k]];
    T[k_] := -a[k] + Complement[Range[z], A[k]];
    s[k_] := Intersection[Range[-a[k], -1], c[k], T[k]];
    Table[If[Length[s[k]] == 0, {h = Min[Intersection[c[k], T[k]]], a[k + 1] = a[k] + h, d[k + 1] = h, k = k + 1}, {h = Max[s[k]], a[k + 1] = a[k] + h, d[k + 1] = h, k = k + 1}], {i, 1, zz}];
    u = Table[a[k], {k, 1, zz}] (* A257705 *)
    Table[d[k], {k, 1, zz}]     (* A131389 *)

Formula

a(k+1) - a(k) = d(k+1) for k >= 1.
Also, a(k) = A131388(n)-1.

A131388 Sequence (a(n)) generated by Rule 1 (in Comments) with a(1) = 1 and d(1) = 0.

Original entry on oeis.org

1, 2, 4, 3, 6, 10, 8, 5, 11, 7, 12, 19, 14, 22, 16, 9, 18, 28, 20, 31, 21, 33, 24, 13, 26, 40, 27, 15, 30, 46, 32, 17, 34, 52, 36, 55, 38, 58, 39, 60, 42, 64, 44, 23, 47, 25, 48, 73, 50, 76, 51, 78, 54, 82, 56, 29, 59, 88, 57, 89, 61, 92, 63, 96, 66, 100, 68, 35, 70, 106, 72, 37
Offset: 1

Views

Author

Clark Kimberling, Jul 05 2007

Keywords

Comments

Rule 1 follows. For k >= 1, let A(k) = {a(1), …, a(k)} and D(k) = {d(1), …, d(k)}. Begin with k = 1 and nonnegative integers a(1) and d(1).
Step 1: If there is an integer h such that 1 - a(k) < h < 0 and h is not in D(k) and a(k) + h is not in A(k), let d(k+1) be the greatest such h, let a(k+1) = a(k) + h, replace k by k + 1, and repeat Step 1; otherwise do Step 2.
Step 2: Let h be the least positive integer not in D(k) such that a(k) + h is not in A(k). Let a(k+1) = a(k) + h and d(k+1) = h. Replace k by k+1 and do Step 1.
Conjecture: if a(1) is an nonnegative integer and d(1) is an integer, then (a(n)) is a permutation of the nonnegative integers (if a(1) = 0) or a permutation of the positive integers (if a(1) > 0). Moreover, (d(n)) is a permutation of the integers if d(1) = 0, or of the nonzero integers if d(1) > 0.
See A257705 for a guide to related sequences.

Examples

			a(2)=1+1, a(3)=a(2)+2, a(4)=a(3)+(-1), a(5)=a(4)+3, a(6)=a(5)+4.
		

Crossrefs

Programs

  • Mathematica
    (*Program 1 *)
    {a, f} = {{1}, {0}}; Do[tmp = {#, # - Last[a]} &[Max[Complement[#, Intersection[a, #]] &[Last[a] + Complement[#, Intersection[f, #]] &[Range[2 - Last[a], -1]]]]];
    If[! IntegerQ[tmp[[1]]], tmp = {Last[a] + #, #} &[NestWhile[# + 1 &, 1, ! (! MemberQ[f,#] && ! MemberQ[a, Last[a] + #]) &]]];
    AppendTo[a, tmp[[1]]]; AppendTo[f, tmp[[2]]], {400}];
    {a, f} (*{A131388, A131389}; Peter J. C. Moses, May 10 2015*)
    (*Program 2 *)
    a[1] = 1; d[1] = 0; k = 1; z = 10000; zz = 120;
    A[k_] := Table[a[i], {i, 1, k}]; diff[k_] := Table[d[i], {i, 1, k}];
    c[k_] := Complement[Range[-z, z], diff[k]];
    T[k_] := -a[k] + Complement[Range[z], A[k]];
    s[k_] := Intersection[Range[-a[k], -1], c[k], T[k]];
    Table[If[Length[s[k]] == 0, {h = Min[Intersection[c[k], T[k]]], a[k + 1] = a[k] + h, d[k + 1] = h, k = k + 1}, {h = Max[s[k]], a[k + 1] = a[k] + h, d[k + 1] = h, k = k + 1}], {i, 1, zz}];
    u = Table[a[k], {k, 1, zz}] (* A131388 *)
    Table[d[k], {k, 1, zz}]     (* A131389 *)

Formula

a(k+1) - a(k) = d(k+1) for k >= 1.

Extensions

Revised by Clark Kimberling, May 12 2015

A131393 Conjectured permutation of the positive integers using Rule 2 with a(1)=1.

Original entry on oeis.org

1, 2, 4, 3, 6, 10, 8, 5, 11, 7, 12, 19, 14, 22, 16, 9, 18, 28, 20, 31, 21, 33, 24, 13, 26, 40, 27, 42, 30, 15, 32, 48, 34, 17, 35, 54, 38, 58, 39, 60, 37, 59, 41, 64, 44, 23, 47, 25, 50, 76, 52, 79, 53, 81, 56, 29, 61, 90, 62, 92, 63, 94, 57, 91, 55, 88, 49, 84, 51, 87, 46, 83
Offset: 1

Views

Author

Clark Kimberling, Jul 05 2007

Keywords

Comments

Conjecture 1: a( ) is a permutation of the positive integers. Conjecture 2: d( ) is a permutation of the integers. The sequence using Rule 1 ("negative before positive") is A131388.
This sequence was generated using "Rule 2" in a computer program which been lost. The wording of "Rule 2" in the Formula section, although flawed, is retained in case someone can rediscover "Rule 2" and contribute a corrected version. - Clark Kimberling, May 18 2015

Examples

			a(2)=1+1, a(3)=a(2)+2, a(4)=a(3)+(-1), a(5)=a(4)+3, a(6)=a(5)+4.
The first term that differs from A131388 is a(28)=42.
		

Crossrefs

Formula

The following version of "Rule 2" is defective; see Comments. - Clark Kimberling, May 18 2015
Rule 2 ("positive before negative"): define sequences d( ) and a( ) as follows: d(1)=0, a(1)=1 and for n>=2, d(n) is the least positive integer d such that a(n-1)+d is not among a(1), a(2),...,a(n-1), or, if no such d exists, then d(n) is the greatest negative integer d such that a(n-1)+d is not among a(1), a(2),...,a(n-1). Then a(n)=a(n-1)+d.

A131394 Conjectured permutation of the integers using Rule 2 with A131393(1)=1.

Original entry on oeis.org

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

Views

Author

Clark Kimberling, Jul 05 2007

Keywords

Comments

Rule 2 is given at A131393. Conjecture: A131394 is a permutation of the integers.

Examples

			See A131393.
		

Crossrefs

Formula

This is the sequence d( ) in the formula for A131393.

A131397 Positions of negative integers in A131394, minus 1.

Original entry on oeis.org

3, 6, 7, 9, 12, 14, 15, 18, 20, 22, 23, 26, 28, 29, 32, 33, 36, 38, 40, 42, 44, 45, 47, 50, 52, 54, 55, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 79, 81, 83, 85, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 109, 110, 113, 115, 116, 118, 120, 122, 124, 126, 128, 130, 132
Offset: 1

Views

Author

Clark Kimberling, Jul 06 2007

Keywords

Comments

If A131394 is a permutation of the integers, as conjectured, then A131397 is the complement of A131396.

Examples

			The 5th negative integer to occur in A131394 is -5, which occurs at position 13, so that a(5) = 13 - 1 = 12.
		

Crossrefs

Formula

a(n) = position of n-th negative integer in A131394, minus 1.
Showing 1-10 of 20 results. Next