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.

A343501 Positions of 4's in A003324.

This page as a plain text file.
%I A343501 #40 Feb 24 2025 18:07:21
%S A343501 4,6,14,16,20,22,24,30,36,38,46,52,54,56,62,64,68,70,78,80,84,86,88,
%T A343501 94,96,100,102,110,116,118,120,126,132,134,142,144,148,150,152,158,
%U A343501 164,166,174,180,182,184,190,196,198,206,208,212,214,216,222,224,228
%N A343501 Positions of 4's in A003324.
%C A343501 Numbers of the form (2*k+1) * 2^e where e >= 1, k+e is even. In other words, union of {(4*m+1) * 2^(2t)} and {(4*m+3) * 2^(2t-1)}, where m >= 0, t > 0.
%C A343501 Numbers whose quaternary (base-4) expansion ends in 100...00 or 1200..00 or 3200..00. At least one trailing zero is required in the first case but not in the latter two cases.
%C A343501 There are precisely 2^(N-2) terms <= 2^N for every N >= 2.
%C A343501 Also even indices of 1 in A209615. - _Jianing Song_, Apr 24 2021
%C A343501 Complement of A343500 with respect to the even numbers. - _Jianing Song_, Apr 26 2021
%H A343501 Jianing Song, <a href="/A343501/b343501.txt">Table of n, a(n) for n = 1..16384</a> (all terms <= 2^16).
%F A343501 a(n) = 2*A338691(n). - _Hugo Pfoertner_, Apr 26 2021
%e A343501 A003324 starts with 1, 2, 3, 4, 1, 4, 3, 2, 1, 2, 3, 2, 1, 4, 3, 4, ... We have A003324(4) = A003324(6) = A003324(14) = A003324(16) = ... = 4, so this sequence starts with 4, 6, 14, 16, ...
%t A343501 okQ[n_] := If[OddQ[n], False, Module[{e = IntegerExponent[n, 2], k}, k = (n/2^e - 1)/2; EvenQ[k + e]]];
%t A343501 Select[Range[1000], okQ] (* _Jean-François Alcover_, Apr 19 2021, after PARI *)
%o A343501 (PARI) isA343501(n) = if(n%2, 0, my(e=valuation(n, 2), k=bittest(n,e+1)); !((k+e)%2))
%o A343501 (Python)
%o A343501 def A343501(n):
%o A343501     def f(x): return n+x-sum(((x>>i)-3>>2)+1 for i in range(1,x.bit_length(),2))-sum(((x>>i)-1>>2)+1 for i in range(2,x.bit_length(),2))
%o A343501     m, k = n, f(n)
%o A343501     while m != k: m, k = k, f(k)
%o A343501     return m # _Chai Wah Wu_, Feb 24 2025
%Y A343501 Cf. A003324, A343500 (positions of 2's), A209615, A338691.
%Y A343501 Even terms in A338692.
%K A343501 nonn,easy
%O A343501 1,1
%A A343501 _Jianing Song_, Apr 17 2021