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.

A274648 A variation on Recamán's sequence (A005132): a(n) is the first positive number of the form a(n-1)-n*k, k>0 not already in the sequence; and if no such number exists, then a(n) is the first number of the form a(n-1)+n*k, k>0 not already in the sequence.

Original entry on oeis.org

0, 1, 3, 6, 2, 7, 13, 20, 12, 21, 11, 22, 10, 23, 9, 24, 8, 25, 43, 5, 45, 66, 44, 67, 19, 69, 17, 71, 15, 73, 103, 72, 40, 106, 38, 108, 36, 110, 34, 112, 32, 114, 30, 116, 28, 118, 26, 120, 168, 119, 169, 16, 68, 121, 175, 65, 177, 63, 179, 61, 181, 59, 183
Offset: 0

Views

Author

Max Barrentine, Aug 12 2016

Keywords

Comments

Is this a permutation of the natural numbers?
The inverse is: 0, 1, 4, 2, 164, 19, 3, 5, 16, 14, 12, 10, 8, 6, 8228, 28, 51, 26, 158, 24, 7, 9, 11, 13, 15, 17, 46, 90, ..., . Robert G. Wilson v, Sep 07 2016
After 3.2*10^11 terms, the smallest number which has not appeared is 154. - Benjamin Chaffin, Oct 05 2016

Crossrefs

Cf. A273148 (inverse), A005132, A274647 (another variant).

Programs

  • Mathematica
    f[s_List] := Block[{k = 1, l = s[[-1]], n = Length@ s}, While[ MemberQ[s, l - k*n] && l > k*n, k++]; If[l > k*n, Append[s, l - k*n], k = 1; While[ MemberQ[s, l + k*n], k++]; Append[s, l + k*n]]]; Nest[f, {0}, 60] (* Robert G. Wilson v, Sep 07 2016 *)