login
Odd part of n modulo 3.
8

%I #11 Aug 29 2024 09:16:21

%S 1,1,0,1,2,0,1,1,0,2,2,0,1,1,0,1,2,0,1,2,0,2,2,0,1,1,0,1,2,0,1,1,0,2,

%T 2,0,1,1,0,2,2,0,1,2,0,2,2,0,1,1,0,1,2,0,1,1,0,2,2,0,1,1,0,1,2,0,1,2,

%U 0,2,2,0,1,1,0,1,2,0,1,2,0,2,2,0,1,1,0,2,2,0,1,2,0,2,2,0,1,1,0,1,2,0

%N Odd part of n modulo 3.

%C 0 if multiple of 3, 1 if of the form 2^j*(3*k+1) with 3*k+1 odd, 2 otherwise.

%H Amiram Eldar, <a href="/A099544/b099544.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) = A010872(A000265(n)).

%F Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = 1. - _Amiram Eldar_, Aug 29 2024

%t a[n_] := Mod[n / 2^IntegerExponent[n, 2], 3]; Array[a, 100] (* _Amiram Eldar_, Aug 29 2024 *)

%o (PARI) a(n) = (n>>valuation(n,2))%3 \\ _Charles R Greathouse IV_, May 14 2014

%Y Cf. A000265, A010872.

%Y Cf. A099545, A099546, A099547, A099548, A099549, A099550, A099551.

%K nonn,easy

%O 1,5

%A _Ralf Stephan_, Oct 23 2004