login
a(n) = n-2 if n is a multiple of 4, a(n) = n-1 otherwise.
1

%I #91 Mar 18 2023 08:49:14

%S 0,1,2,2,4,5,6,6,8,9,10,10,12,13,14,14,16,17,18,18,20,21,22,22,24,25,

%T 26,26,28,29,30,30,32,33,34,34,36,37,38,38,40,41,42,42,44,45,46,46,48,

%U 49,50,50,52,53,54,54,56,57,58,58,60,61,62,62,64,65,66,66,68,69

%N a(n) = n-2 if n is a multiple of 4, a(n) = n-1 otherwise.

%C a(n) is the rank of the walk matrix of the Dynkin graph Dn, a tree obtained from the path of order n-1 by adding a pendant edge at the second vertex. see Wang et al.

%H Wei Wang, Chuanming Wang, and Songlin Guo, <a href="https://arxiv.org/abs/2202.13279">On the walk matrix of the Dynkin graph Dn</a>, arXiv:2202.13279 [math.CO], 2022.

%H <a href="/index/Rec#order_05">Index entries for linear recurrences with constant coefficients</a>, signature (1,0,0,1,-1).

%F From _Wesley Ivan Hurt_, Mar 03 2022: (Start)

%F a(n) = n - 2 + sign(n mod 4).

%F a(n) = n - 1 - A121262(n). (End)

%t a[n_] := If[Divisible[n, 4], n - 2, n - 1]; Array[a, 70] (* _Amiram Eldar_, Mar 03 2022 *)

%o (PARI) a(n) = if (n%4, n-1, n-2);

%o (Python)

%o def A351782(n): return n - 1 - int(n % 4 == 0) # _Chai Wah Wu_, Mar 04 2022

%Y Cf. A121262.

%K nonn,easy

%O 1,3

%A _Michel Marcus_, Mar 03 2022