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.

A078826 Number of distinct primes contained as binary substrings in binary representation of n.

This page as a plain text file.
%I A078826 #11 Jul 17 2015 05:58:02
%S A078826 0,0,1,1,1,2,2,2,1,1,2,4,2,4,3,2,1,2,1,3,2,2,4,6,2,2,4,5,3,6,3,3,1,1,
%T A078826 2,3,1,3,3,4,2,3,2,5,4,5,6,7,2,3,2,3,4,5,5,7,3,3,6,8,3,7,4,3,1,1,1,3,
%U A078826 2,3,3,5,1,2,3,5,3,5,4,5,2,3,3,6,2,2,5,7,4,5,5,5,6,8,7,8,2,3,3,3,2,5,3,5,4
%N A078826 Number of distinct primes contained as binary substrings in binary representation of n.
%C A078826 A143792(n) <= a(n) for n > 0. - _Reinhard Zumkeller_, Sep 08 2008
%C A078826 For n > 1: number of primes in n-th row of A165416, lengths in n-th row of A225243. - _Reinhard Zumkeller_, Jul 17 2015, Aug 14 2013
%H A078826 Reinhard Zumkeller, <a href="/A078826/b078826.txt">Table of n, a(n) for n = 0..10000</a>
%e A078826 n=7 -> '111' contains 2 different binary substrings which are primes: '11' (11b or b11) and '111' itself, therefore a(7)=2.
%t A078826 a[n_] := (bits = IntegerDigits[n, 2]; lg = Length[bits]; Reap[Do[If[PrimeQ[p = FromDigits[bits[[i ;; j]], 2]], Sow[p]], {i, 1, lg-1}, {j, i+1, lg}]][[2, 1]] // Union // Length); a[0] = a[1] = 0; Table[a[n], {n, 0, 104}] (* _Jean-François Alcover_, May 23 2013 *)
%o A078826 (Haskell)
%o A078826 a078826 n | n <= 1 = 0
%o A078826           | otherwise = length $ a225243_row n
%o A078826 -- _Reinhard Zumkeller_, Aug 14 2013
%Y A078826 Cf. A004676, A035232, A078827, A078822, A007088, A001221.
%Y A078826 Cf. A143792, A165416, A225243.
%K A078826 nonn,base
%O A078826 0,6
%A A078826 _Reinhard Zumkeller_, Dec 08 2002