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

A258136 Lexicographically earliest sequence of odd positive integers such that the terms and their absolute first differences are all distinct.

Original entry on oeis.org

1, 3, 7, 13, 5, 15, 27, 9, 23, 39, 11, 31, 53, 17, 41, 67, 19, 49, 81, 21, 55, 93, 25, 65, 107, 29, 73, 119, 33, 83, 135, 35, 89, 145, 37, 95, 157, 43, 109, 45, 115, 187, 47, 121, 197, 51, 131, 213, 57, 141, 229, 59, 149, 241, 61, 155, 251, 63, 161, 263, 69
Offset: 1

Views

Author

Eric Angelini and Alois P. Heinz, May 21 2015

Keywords

Crossrefs

Cf. A081145, A258137 (absolute first differences), A257941, A257944.

Programs

  • Maple
    b:= proc() false end:
    a:= proc(n) option remember; local k;
          if n=1 then b(1):= true; 1
        else a(n-1); for k while b(k) or
             b(abs(a(n-1)-k)) by 2 do od;
             b(k), b(abs(a(n-1)-k)):= true$2; k
          fi
        end:
    seq(a(n), n=1..101);
  • Mathematica
    b[_] = False;
    a[n_] := a[n] = Module[{k},
         If[n == 1, b[1] = True; 1,
         a[n-1]; For[k = 1, b[k] ||
         b[Abs[a[n-1] - k]], k += 2];
         {b[k], b[Abs[a[n-1] - k]]} = {True, True}; k]];
    Table[a[n], {n, 1, 101}] (* Jean-François Alcover, Aug 01 2021, after Alois P. Heinz *)

Formula

a(n) = 2*A081145(n)-1.
Showing 1-1 of 1 results.