login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

a(n) = reverse(10*n - a(n-1)), with n>1, a(1) = 1.
1

%I #30 Jan 06 2021 16:00:53

%S 1,91,-16,65,-51,111,-14,49,14,68,24,69,16,421,-172,233,-36,612,-224,

%T 424,-412,236,-6,642,-293,355,-58,833,-345,546,-632,259,17,323,72,882,

%U -215,595,-502,209,102,813,-383,328,221,932,-264,447,34,664,-451

%N a(n) = reverse(10*n - a(n-1)), with n>1, a(1) = 1.

%C Note that for x<0, reverse(x) is defined by -1*reverse(-x).

%C Starting the sequence with other numbers also gives similar-looking graphs.

%H Clément Vovard, <a href="/A339141/b339141.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) = reverse(10*n - a(n-1)) where reverse means reverse the order of the digits.

%e For n = 2, 10*n = 10*2 = 20, 20 - a(n-1) = 20 - 1 = 19, reverse(19) = 91.

%e For n = 3, 10*n = 10*3 = 30, 30 - a(3-1) = 30 - 91 = -61, reverse(-61) = -16.

%p a:= proc(n) option remember; `if`(n<2, n, (p-> signum(p)* (f->

%p parse(cat(f[-i]$i=1..length(f))))(""||(abs(p))))(10*n-a(n-1)))

%p end:

%p seq(a(n), n=1..60); # _Alois P. Heinz_, Jan 06 2021

%t 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 *)

%o (PARI) rev(n) = sign(n)*fromdigits(Vecrev(digits(n)));

%o a(n) = if (n==1, 1, rev(10*n-a(n-1))); \\ _Michel Marcus_, Dec 05 2020

%Y Cf. A004086, A166525.

%K sign,look,base

%O 1,2

%A _Clément Vovard_, Nov 25 2020