A115303 a(n) = n if n < 3, otherwise 3*a(floor(n/3)) + 2 - n mod 3.
1, 2, 5, 4, 3, 8, 7, 6, 17, 16, 15, 14, 13, 12, 11, 10, 9, 26, 25, 24, 23, 22, 21, 20, 19, 18, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62
Offset: 1
Links
Programs
-
Maple
a:= proc(n) option remember; 3*procname(floor(n/3))+2 - (n mod 3) end proc: a(1):= 1: a(2):= 2: map(a, [$1..100]); # Robert Israel, Feb 28 2023
-
Mathematica
A115303[n_] := FromDigits[MapAt[2 - # &, IntegerDigits[n, 3], 2;;], 3]; Array[A115303, 100] (* Paolo Xausa, May 20 2024 *)
Formula
a(n) = A115310(n+1,2).
Comments