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.
%I A270438 #33 Apr 24 2025 16:55:58 %S A270438 1,2,2,2,2,4,2,4,2,4,4,4,2,4,4,8,2,4,4,4,4,8,4,8,2,4,4,8,4,8,8,16,2,4, %T A270438 4,4,4,8,4,8,4,8,8,8,4,8,8,16,2,4,4,8,4,8,8,16,4,8,8,16,8,16,16,32,2, %U A270438 4,4,4,4,8,4,8,4,8,8,8,4,8,8,16,4,8,8 %N A270438 a(n) is the number of entries == 1 mod 4 in row n of Pascal's triangle. %C A270438 All entries are powers of 2. %H A270438 Robert Israel, <a href="/A270438/b270438.txt">Table of n, a(n) for n = 0..10000</a> %H A270438 Kenneth S. Davis and William A. Webb, <a href="https://web.archive.org/web/2024*/https://www.fq.math.ca/Scanned/29-1/davis.pdf">Pascal's triangle modulo 4</a>, Fib. Quart., 29 (1991), 79-83. %H A270438 A. Granville, <a href="http://www.jstor.org/stable/2324898">Zaphod Beeblebrox's Brain and the Fifty-ninth Row of Pascal's Triangle</a>, The American Mathematical Monthly, 99(4) (1992), 318-331. %F A270438 a(n) = 2^(A000120(n) - min(1, A014081(n))). [Davis & Webb] %e A270438 Row 3 of Pascal's triangle is (1,3,3,1) and has two entries == 1 (mod 4), so a(3) = 2. %p A270438 f:= proc(n) local L,m; %p A270438 L:= convert(n,base,2); %p A270438 m:= convert(L,`+`); %p A270438 if has(L[1..-2]+L[2..-1],2) then 2^(m-1) else 2^m fi %p A270438 end proc: %p A270438 map(f, [$0..1000]); %t A270438 Count[#, 1] & /@ Table[Mod[Binomial[n, k], 4], {n, 0, 120}, {k, 0, n}] (* _Michael De Vlieger_, Feb 26 2017 *) %o A270438 (PARI) a(n) = 2^(hammingweight(n) - min(hammingweight(bitand(n, n>>1)),1)) \\ _Charles R Greathouse IV_, Jul 13 2016 %o A270438 (Python) %o A270438 def A270438(n): return 1<<n.bit_count()-min(1,n&(n>>1)).bit_count() # _Chai Wah Wu_, Apr 24 2025 %Y A270438 Cf. A034931, A163000, A000120, A007318, A014081. %K A270438 nonn,easy %O A270438 0,2 %A A270438 _Robert Israel_, Jul 12 2016