OFFSET
0,2
LINKS
Amiram Eldar, Table of n, a(n) for n = 0..10000
FORMULA
a(0) = 0; if n is odd then a(n) = 2, otherwise a(n) = A007814(n). - Andrey Zabolotskiy, Jan 08 2024
Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = 2. - Amiram Eldar, Aug 30 2024
EXAMPLE
Seen as an irregular table for n >= 1:
2,
1, 2,
2, 2, 1, 2,
3, 2, 1, 2, 2, 2, 1, 2,
4, 2, 1, 2, 2, 2, 1, 2, 3, 2, 1, 2, 2, 2, 1, 2,
5, 2, 1, 2, 2, 2, 1, 2, 3, 2, 1, 2, 2, 2, 1, 2, 4, 2, 1, 2, ....
MAPLE
MATHEMATICA
a[0] = 0; a[n_] := If[Divisible[n, 4], IntegerExponent[n, 2], Mod[n, 2] + 1]; Array[a, 100, 0] (* Amiram Eldar, Aug 30 2024 *)
PROG
(SageMath)
def A327491(n):
if n == 0: return 0
if 4.divides(n): return valuation(n, 2)
return n % 2 + 1
print([A327491(n) for n in (0..87)])
(PARI) a(n)={if(n==0, 0, if(n%4, n%2 + 1, valuation(n, 2)))} \\ Andrew Howroyd, Sep 28 2019
CROSSREFS
KEYWORD
nonn
AUTHOR
Peter Luschny, Sep 27 2019
STATUS
approved