OFFSET
1,2
COMMENTS
Note that for x<0, reverse(x) is defined by -1*reverse(-x).
Starting the sequence with other numbers also gives similar-looking graphs.
LINKS
Clément Vovard, Table of n, a(n) for n = 1..10000
FORMULA
a(n) = reverse(10*n - a(n-1)) where reverse means reverse the order of the digits.
EXAMPLE
For n = 2, 10*n = 10*2 = 20, 20 - a(n-1) = 20 - 1 = 19, reverse(19) = 91.
For n = 3, 10*n = 10*3 = 30, 30 - a(3-1) = 30 - 91 = -61, reverse(-61) = -16.
MAPLE
a:= proc(n) option remember; `if`(n<2, n, (p-> signum(p)* (f->
parse(cat(f[-i]$i=1..length(f))))(""||(abs(p))))(10*n-a(n-1)))
end:
seq(a(n), n=1..60); # Alois P. Heinz, Jan 06 2021
MATHEMATICA
nmax=51; a[1]=1; a[n_]:=Sign[10n-a[n-1]]IntegerReverse[10n-a[n-1]]; Table[a[n], {n, nmax}] (* Stefano Spezia, Dec 05 2020 *)
PROG
(PARI) rev(n) = sign(n)*fromdigits(Vecrev(digits(n)));
a(n) = if (n==1, 1, rev(10*n-a(n-1))); \\ Michel Marcus, Dec 05 2020
CROSSREFS
KEYWORD
AUTHOR
Clément Vovard, Nov 25 2020
STATUS
approved