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.

Previous Showing 21-23 of 23 results.

A232271 Start with positive integers (A000027), and at each step n >= 1 subtract from the term at position n + a(n) the value a(n).

Original entry on oeis.org

1, 1, 2, 4, 3, 6, 7, 1, 8, 10, 11, 6, 13, 7, 15, 16, 9, 12, 30, 10, 14, 11, 23, 24, 25, 4, 27, 28, 29, -11, 31, 16, 22, 34, 21, 36, 37, 19, 39, 40, 41, 42, 43, 44, 45, 23, 47, 8, 49, 25, 51, 52, 53, 27, 34, -1, 38, 29, 59, 60, 61, 31, 63, 64, 65, 66, 67, 34, 307, 70, 71
Offset: 1

Views

Author

Alex Ratushnyak, Nov 22 2013

Keywords

Comments

The first 71 terms are correct if the following conjecture is true: n+a(n)<=0 or n+a(n)>71 for n >= 2^30.
The sequence of negative terms begins: -11, -1, -261, -11, -253, -319, -341, -407, -451, -528, -329, -371, -29, -31, -649, -619, -427, -737, -37, ...
Indices of negative terms: 30, 56, 330, 616, 690, 870, 930, 1110, 1230, 1288, 1410, 1590, 1624, 1736, 1770, 1820, 1830, 2010, 2072, ...
Numbers n such that a(n)=n: 1, 4, 6, 7, 10, 11, 13, 15, 16, 23, 24, 25, 27, 28, 29, 31, 34, 36, 37, 39, 40, 41, 42, 43, 44, 45, ...
The sequence of numbers n such that n+a(n)<0 begins: 1485264, 2029290, 6156150, 6872250, 8338512, 8769090, 10420410, 13448490, 16654110, 25894770, ...

Crossrefs

Programs

  • Python
    TOP = 2**30  # if enough RAM
    a = [1]*TOP
    for n in range(1,TOP):
      a[n]=n
    for n in range(1,TOP):
      if n+a[n]0: a[n+a[n]] -= a[n]
    for n in range(1,1000):
      print(a[n], end=', ')

Extensions

Corrected by Alex Ratushnyak, Dec 28 2013

A335663 For n >= 1, a(n) = f(n) where f is a bijection on Z such that f(x)-x is also a bijection on Z and f(f(x)) = x.

Original entry on oeis.org

2, 1, 6, 9, 12, 3, 16, 19, 4, 23, 26, 5, 30, 33, 36, 7, 40, 43, 8, 47, 50, 53, 10, 57, 60, 11, 64, 67, 70, 13, 74, 77, 14, 81, 84, 15, 88, 91, 94, 17, 98, 101, 18, 105, 108, 111, 20, 115, 118, 21, 122, 125, 22, 129, 132, 135, 24, 139, 142, 25, 146, 149, 152
Offset: 1

Views

Author

Bhavya Tiwari, Jun 17 2020

Keywords

Comments

This appears in the problem of finding a bijection f on Z such that f(x)-x is also a bijection on Z. a(n) is the value on the natural numbers of an f satisfying the above condition as well as f(f(n)) = n. It is interesting to note that all a(n) such that a(n) > n are precisely A184119 (empirical) and ones satisfying a(n) <= n are precisely A136119 (empirical).

Examples

			We begin with a(1) = 2.
To calculate a(2): we first check if 2 has appeared in this sequence before. Indeed since a(1) = 2 we set a(2) = 1.
For a(3): observe that 3 has not appeared before so we can't apply Rule 1. Since we have performed rule 2 zero times before, therefore, a(3) = 3+2(0)+3 = 6.
For a(4): we cannot apply Rule 1 as 4 has not appeared before. We have applied Rule 2 one time before and hence a(4) = 4+2(1)+3 = 9.
Similarly a(5) = 5+2(2)+3 = 12.
However for a(6) we see a(3) = 6 and hence due to Rule 1, we must set a(6) = 3.
		

Crossrefs

Programs

  • Maple
    a:= proc() local h, t; t:=0; proc(n) option remember;
          if n<3 then 3-n else h:= 3+n+2*t;
            a(h):= n; t:= t+1; h fi end
        end():
    seq(a(n), n=1..100);  # Alois P. Heinz, Jun 17 2020
  • Mathematica
    Nest[Append[#1, If[! FreeQ[#1[[All, 1]], #2], {FirstPosition[#1[[All, 1]], #2][[1]], #1[[-1, -1]]}, {#2 + 2 #1[[-1, -1]] + 3, 1 + #1[[-1, -1]]}]] & @@ {#, Length[#] + 1} &, {{2, 0}}, 62][[All, 1]] (* Michael De Vlieger, Jun 17 2020 *)
  • Python
    Used = [(1, 2)]
    def bfun(num):
        print("a(1)=2")
        for i in range(2, num + 1):
            if any(i in coordinate for coordinate in Used):
                for j in range(0, len(Used) + 1):
                    if i in Used[j]:
                        print("a(" + str(i) + ")=" + str(Used[j][0]))
                        break
            else:
                Used.append((i, i + 2 * len(Used) + 1))
                print("a(" + str(i) + ")=" + str(i + 2 * len(Used) - 1))
    bfun(70)

Formula

a(1) = 2 and for all i > 1 we define a(i) as follows:
Rule 1 : a(i) = j if there is some j such that j < i and a(j) = i.
Rule 2 : If Rule 1 cannot be performed then a(i) = i+2n+3 , if this rule applied n times previously.

A369422 Lexicographically earliest infinite sequence such that no two equal unordered pairs (a(j), a(k)) have the same distance abs(j-k).

Original entry on oeis.org

1, 1, 2, 3, 4, 2, 5, 6, 3, 7, 8, 4, 9, 10, 11, 5, 12, 13, 6, 14, 15, 16, 7, 17, 18, 8, 19, 20, 21, 9, 22, 23, 10, 24, 25, 11, 26, 27, 28, 12, 29, 30, 13, 31, 32, 33, 14, 34, 35, 15, 36, 37, 16, 38, 39, 40, 17, 41, 42, 18, 43, 44, 45, 19, 46, 47, 20, 48, 49, 21, 50, 51, 52, 22, 53, 54, 23, 55, 56, 57, 24, 58, 59, 25, 60, 61
Offset: 1

Views

Author

Neal Gersh Tolunsky, Jan 22 2024

Keywords

Comments

In other words: The absolute distance between the indices of any two terms (A and B) is distinct among all pairs of terms in the sequence with the same two values (A and B).
No value can occur more than twice: 1) If two terms have the same value, one term must be at an odd index and the other at an even index. Otherwise we would have a middle term B equidistant from two equal terms in an ABA-form progression, which contradicts the sequence's definition. 2) So we can have at most one term with a given value at an even index and one at an odd index.
Any unordered pair (A, B) has a maximum of 4 distinct distances (A1 to B1, A1 to B2, A2 to B1, A2 to B2).
For the equivalent sequence using ordered pairs, see A337226.

Examples

			a(7)=5: We cannot have a(7)=1 because then, for example, the unordered pair (1,2) would have the same absolute distance twice at distinct indices:
1, 1, 2, 3, 4, 2, 1
   1--2        2--1
a(7) could not equal 2 because again the pair (1,2) would have the same absolute distance twice at different indices (i=6-1=5 and i=7-2=5):
1, 1, 2, 3, 4, 2, 2
1--------------2
   1--------------2
a(7) cannot be 3 because of the following two equal unordered pairs, which would have the same distance:
1, 1, 2, 3, 4, 2, 3
      2--3     2--3
a(7) cannot be 4, or we would have two equal unordered pairs both with distance 1:
1, 1, 2, 3, 4, 2, 4
            4--2
               2--4
a(7) can be 5 without restriction since 5 is a first occurrence and every unordered pair with 5 has a distinct distance.
		

Crossrefs

Cf. A136119, A184119 (conjectured first and second occurrences).
Previous Showing 21-23 of 23 results.