login
A168221
a(n) = A006368(A006368(n)).
5
0, 1, 2, 3, 9, 6, 7, 4, 18, 5, 11, 12, 27, 15, 16, 8, 36, 10, 20, 21, 45, 24, 25, 13, 54, 14, 29, 30, 63, 33, 34, 17, 72, 19, 38, 39, 81, 42, 43, 22, 90, 23, 47, 48, 99, 51, 52, 26, 108, 28, 56, 57, 117, 60, 61, 31, 126, 32, 65, 66, 135, 69, 70, 35, 144, 37, 74, 75, 153, 78, 79, 40
OFFSET
0,3
COMMENTS
Inverse integer permutation to A168222;
a(A006369(n)) = A006368(n).
FORMULA
From Luce ETIENNE, Aug 14 2019: (Start)
a(n) = 2*a(n-16) - a(n-32).
a(n) = (-18*(40*m^7 - 973*m^6 + 9352*m^5 - 45115*m^4 + 114520*m^3 - 145432*m^2 + 75168*m - 10080)*floor(n/8) - m*(332*m^6 - 7973*m^5 + 75236*m^4 - 352835*m^3 + 855008*m^2 - 999992*m + 422664) + m*(4*m^6 - 105*m^5 + 1120*m^4 - 6195*m^3 + 18676*m^2 - 28980*m + 18000)*(-1)^(n/8))/10080 where m = n mod 8.
(End)
From A.H.M. Smeets, Aug 14 2019: (Start)
a(4*n) = 9*n.
a(8*n+1) = a(8*n-1)+1, n > 0.
a(8*n+3) = a(8*n+2)+1.
a(8*n+5) = a(8*n+3)+3 = a(8*n+2)+4.
a(8*n+6) = a(8*n+5)+1 = a(8*n+3)+4 = a(8*n+2)+5.
a(16*n+1) = 9*n+1.
a(16*n+2) = 18*n+2.
a(16*n+3) = a(16*n+2)+1 = 18*n+3.
a(16*n+5) = a(16*n+3)+3 = 18*n+6.
a(16*n+6) = a(16*n+5)+1 = 18*n+7.
a(16*n+7) = (a(16*n+6)+1)/2 = 9*n+4.
a(16*n+9) = 9*n+5.
a(16*n+10) = 2*a(16*n+9)+1 = 18*n+11.
a(16*n+11) = a(16*n+10)+1 = 18*n+12.
a(16*n+13) = a(16*n+11)+3 = 18*n+15.
a(16*n+14) = a(16*n+13) = 18*n+16.
a(16*n+15) = a(16*n+14)/2 = 9*n+8.
From this, (9*n-7)/16 <= a(n) <= 9*n/4.
(End)
From Colin Barker, Aug 23 2019: (Start)
G.f.: x*(1 - x + x^2)*(1 + 3*x + 5*x^2 + 11*x^3 + 12*x^4 + 8*x^5 + 10*x^7 + 14*x^8 + 13*x^9 + 8*x^10 + 13*x^11 + 14*x^12 + 10*x^13 + 8*x^15 + 12*x^16 + 11*x^17 + 5*x^18 + 3*x^19 + x^20) / ((1 - x)^2*(1 + x)^2*(1 + x^2)^2*(1 + x^4)^2*(1 + x^8)).
a(n) = a(n-8) + a(n-16) - a(n-24) for n>23.
(End)
MATHEMATICA
Table[Nest[If[OddQ[#], Floor[(3#+2)/4], 3#/2]&, n, 2], {n, 0, 100}] (* Paolo Xausa, Dec 15 2023 *)
LinearRecurrence[{0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, -1}, {0, 1, 2, 3, 9, 6, 7, 4, 18, 5, 11, 12, 27, 15, 16, 8, 36, 10, 20, 21, 45, 24, 25, 13}, 80] (* Harvey P. Dale, Feb 07 2024 *)
PROG
(Python)
def A006368(n):
if n%2 == 0:
return 3*(n//2)
elif n%4 == 1:
return 3*(n//4)+1
else:
return 3*(n+1)//4-1
n = 0
while n < 30:
print(n, A006368(A006368(n)))
n = n+1 # A.H.M. Smeets, Aug 14 2019
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Reinhard Zumkeller, Nov 20 2009
STATUS
approved