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.

A270438 a(n) is the number of entries == 1 mod 4 in row n of Pascal's triangle.

Original entry on oeis.org

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, 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, 4, 4, 4, 4, 8, 4, 8, 4, 8, 8, 8, 4, 8, 8, 16, 4, 8, 8
Offset: 0

Views

Author

Robert Israel, Jul 12 2016

Keywords

Comments

All entries are powers of 2.

Examples

			Row 3 of Pascal's triangle is (1,3,3,1) and has two entries == 1 (mod 4), so a(3) = 2.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local L,m;
      L:= convert(n,base,2);
      m:= convert(L,`+`);
      if has(L[1..-2]+L[2..-1],2) then 2^(m-1) else 2^m fi
    end proc:
    map(f, [$0..1000]);
  • Mathematica
    Count[#, 1] & /@ Table[Mod[Binomial[n, k], 4], {n, 0, 120}, {k, 0, n}] (* Michael De Vlieger, Feb 26 2017 *)
  • PARI
    a(n) = 2^(hammingweight(n) - min(hammingweight(bitand(n, n>>1)),1)) \\ Charles R Greathouse IV, Jul 13 2016
    
  • Python
    def A270438(n): return 1<>1)).bit_count() # Chai Wah Wu, Apr 24 2025

Formula

a(n) = 2^(A000120(n) - min(1, A014081(n))). [Davis & Webb]