cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A327491 a(0) = 0. If 4 divides n then a(n) = valuation(n, 2) else a(n) = (n mod 2) + 1.

This page as a plain text file.
%I A327491 #25 Aug 30 2024 03:23:36
%S A327491 0,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,
%T A327491 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,6,2,1,2,
%U A327491 2,2,1,2,3,2,1,2,2,2,1,2,4,2,1,2,2,2,1,2
%N A327491 a(0) = 0. If 4 divides n then a(n) = valuation(n, 2) else a(n) = (n mod 2) + 1.
%H A327491 Amiram Eldar, <a href="/A327491/b327491.txt">Table of n, a(n) for n = 0..10000</a>
%F A327491 a(0) = 0; if n is odd then a(n) = 2, otherwise a(n) = A007814(n). - _Andrey Zabolotskiy_, Jan 08 2024
%F A327491 Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = 2. - _Amiram Eldar_, Aug 30 2024
%e A327491 Seen as an irregular table for n >= 1:
%e A327491   2,
%e A327491   1, 2,
%e A327491   2, 2, 1, 2,
%e A327491   3, 2, 1, 2, 2, 2, 1, 2,
%e A327491   4, 2, 1, 2, 2, 2, 1, 2, 3, 2, 1, 2, 2, 2, 1, 2,
%e A327491   5, 2, 1, 2, 2, 2, 1, 2, 3, 2, 1, 2, 2, 2, 1, 2, 4, 2, 1, 2, ....
%p A327491 A327491 := n -> if n = 0 then 0
%p A327491 elif 0 = irem(n, 4) then padic[ordp](n, 2)
%p A327491 elif 0 = irem(n, 2) then 1 else 2 fi:
%p A327491 seq(A327491(n), n=0..87);
%t A327491 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 *)
%o A327491 (SageMath)
%o A327491 def A327491(n):
%o A327491     if n == 0: return 0
%o A327491     if 4.divides(n): return valuation(n, 2)
%o A327491     return n % 2 + 1
%o A327491 print([A327491(n) for n in (0..87)])
%o A327491 (PARI) a(n)={if(n==0, 0, if(n%4, n%2 + 1, valuation(n,2)))} \\ _Andrew Howroyd_, Sep 28 2019
%Y A327491 Cf. A327492, A327493, A327494, A327495.
%K A327491 nonn
%O A327491 0,2
%A A327491 _Peter Luschny_, Sep 27 2019