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.

A076141 Number of times n occurs as a binary sub-pattern of n^2.

Original entry on oeis.org

1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Offset: 0

Views

Author

Reinhard Zumkeller, Oct 31 2002

Keywords

Comments

a(A018826(n))>0; is a(n)<=1 for all n?
Not multiplicative: a(5) = 0, a(29) = 0, a(145) = 1. - David W. Wilson, Jun 10 2005
a(n) <= 1 for n <= 10^6. - Robert Israel, Jul 11 2018

Examples

			a(27) = 1 as 27 = '11011' occurs in 27^2=729 = '1011011001' once: '**11011***'.
		

Crossrefs

Cf. A018826.

Programs

  • Maple
    f:= proc(n) local S,S2;
        S:= convert(convert(n,binary),string);
        S2:= convert(convert(n^2,binary),string);
        nops([StringTools:-SearchAll(S,S2)])
    end proc:
    map(f, [$0..200]); # Robert Israel, Jul 11 2018
  • PARI
    issub(b, bs, k) = {for (i=1, #b, if (b[i] != bs[i+k-1], return (0));); return (1);}
    a(n) = {if (n, b = binary(n), b = [0]); if (n, bs = binary(n^2), bs = [0]); sum(k=1, #bs - #b +1, issub(b, bs, k));} \\ Michel Marcus, Mar 15 2015