A071338 Duplicate of A078826.
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, 2, 3
Offset: 1
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.
n=10 -> '1010' contains 5 different binary numbers: '0' (b0bb or bbb0), '1' (1bbb or bb1b), '10' (10bb or bb10), '101' (101b) and '1010' itself, therefore a(10)=5.
a078822 = length . a119709_row import Numeric (showIntAtBase) -- Reinhard Zumkeller, Aug 13 2013, Sep 14 2011
a:= n-> (s-> nops({seq(seq(parse(s[i..j]), i=1..j), j=1..length(s))}))(""||(convert(n, binary))): seq(a(n), n=0..85); # Alois P. Heinz, Jan 20 2021
a[n_] := (id = IntegerDigits[n, 2]; nd = Length[id]; Length[ Union[ Flatten[ Table[ id[[j ;; k]], {j, 1, nd}, {k, j, nd}], 1] //. {0, b__} :> {b}]]); Table[ a[n], {n, 0, 85}] (* Jean-François Alcover, Dec 01 2011 *)
a(n) = {if (n==0, 1, vb = binary(n); vf = []; for (i=1, #vb, for (j=1, #vb - i + 1, pvb = vector(j, k, vb[i+k-1]); f = subst(Pol(pvb), x, 2); vf = Set(concat(vf, f)); ); ); #vf); } \\ Michel Marcus, May 08 2016; corrected Jun 13 2022
def a(n): return 1 if n == 0 else len(set(((((2<>i for i in range(n.bit_length()) for l in range(n.bit_length()-i))) print([a(n) for n in range(64)]) # Michael S. Branicky, Jul 28 2022
. n T(n,*) | in binary . --- --------------------|------------------------------------------- . 1: 1 | 00001: . . 2: 2 | 00100: ___10 . 3: 3 | 00011: ___11 . 4: 2 | 00100: __10_ . 5: 2 5 | 00101: ___10 _11__ . 6: 2 3 | 00110: ___10 __11_ . 7: 3 7 | 00111: __11_ __111 . 8: 2 | 01000: _10__ . 9: 2 | 01001: _10__ . 10: 2 5 | 01010: _10__ _101_ . 11: 2 3 5 11 | 01011: _10__ ___11 _101_ 01011 . 12: 2 3 | 01100: ___10 _11__ . 13: 2 3 5 13 | 01101: __10_ _11__ __101 01101 . 14: 2 3 7 | 01110: ___10 _11__ _111_ . 15: 3 7 | 01111: _11__ _111_ . 16: 2 | 10000: 10___ . 17: 2 17 | 10001: 10___ 10001 . 18: 2 | 10010: 10___ . 19: 2 3 19 | 10011: 10___ ___11 10011 . 20: 2 5 | 10100: 10___ 101__ . 21: 2 5 | 10101: 10___ 101__ . 22: 2 3 5 11 | 10110: 10___ __11_ 101__ 10110 . 23: 2 3 5 7 11 23 | 10111: 10___ __11_ 101__ __111 1011_ 10111 . 24: 2 3 | 11000: _10__ 11___ . 25: 2 3 | 11001: _10__ 11___ .
a225243 n k = a225243_tabf !! (n-1) !! (k-1) a225243_row n = a225243_tabf !! (n-1) a225243_tabf = [1] : map (filter ((== 1) . a010051')) (tail a165416_tabf)
Array[Union@ Select[FromDigits[#, 2] & /@ Rest@ Subsequences@ IntegerDigits[#, 2], PrimeQ] &, 34] /. {} -> {1} // Flatten (* Michael De Vlieger, Jan 26 2022 *)
from sympy import isprime from itertools import count, islice def primess(n): b = bin(n)[2:] ss = (int(b[i:j], 2) for i in range(len(b)) for j in range(i+2, len(b)+1)) return sorted(set(k for k in ss if isprime(k))) def agen(): yield 1 for n in count(2): yield from primess(n) print(list(islice(agen(), 82))) # Michael S. Branicky, Jan 26 2022
n=12 -> '1100' contains 2 binary substrings which are primes: '11' (11bb) and '10' (b11b); 3='11' is the greater one, therefore a(12)=3.
a078833 = last . a225243_row -- Reinhard Zumkeller, Aug 14 2013
n=7 -> '111' contains 3 binary substrings which are primes: '11' (11b), '11' (b11) and '111' itself, therefore a(7)=2.
a078832 = head . a225243_row -- Reinhard Zumkeller, Aug 14 2013
60 in binary is 111100. The distinct primes dividing 60 are 2 (which is 10 in binary), 3 (11 in binary) and 5 (101) in binary. The string 10 does occur within 111100 like so: 111(10)0. The string 11 also occurs (multiple times) within 111100, in one way like so: (11)1100. But the string 101 does not occur in 111100. Since 2 and 3 occur within 60 (when each of these numbers is written in binary), but 5 does not, then a(60) = 2.
import Data.List (intersect) a143792 n = length $ a225243_row n `intersect` a027748_row (fromIntegral n) -- Reinhard Zumkeller, Aug 14 2013
f[n_] := Block[{nb = ToString@ FromDigits@ IntegerDigits[n, 2], psb = ToString@ FromDigits@ IntegerDigits[ #, 2] & /@ First@ Transpose@ FactorInteger@ n, c = 0, k = 1}, lmt = 1 + Length@ psb; While[k < lmt, If[ StringCount[nb, psb[[k]]] > 0, c++ ]; k++ ]; c]; f[1] = 0; Array[f, 105] (* Robert G. Wilson v, Sep 22 2008 *)
n=18 -> '10010' contains only 1 distinct binary substring which is prime: '10' (10bbb or bbb10), therefore 18 is a term.
a078829 n = a078829_list !! (n-1) a078829_list = filter ((== 1) . a078826) [1..] -- Reinhard Zumkeller, Jul 17 2015
primeCount[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); primeCount[1] = 0; Select[Range[3000], primeCount[#] == 1 &] (* Jean-François Alcover, May 23 2013 *)
n=12 -> '1100' contains two substrings representing distinct primes: '10'=2 and '11'=3, therefore 12 is a term.
The first terms, alongside the binary representations of n and of the corresponding prime numbers, are: n a(n) bin(n) {bin(p)} -- ---- ------ -------------------- 0 0 0 {} 1 0 1 {} 2 1 10 {10} 3 1 11 {11} 4 1 100 {10} 5 3 101 {10, 11, 101} 6 2 110 {10, 11} 7 2 111 {11, 111} 8 1 1000 {10} 9 3 1001 {10, 11, 101} 10 3 1010 {10, 11, 101} 11 5 1011 {10, 11, 101, 111, 1011} 12 2 1100 {10, 11}
b:= proc(n) option remember; `if`(n=0, {0}, map(x-> [x, 2*x+r][], b(iquo(n, 2, 'r')))) end: a:= n-> nops(select(isprime, b(n))): seq(a(n), n=0..84); # Alois P. Heinz, Jan 26 2022
a(n,base=2) = { my (b=digits(n,base), s=[0]); for (k=1, #b, s = setunion(s, apply(o -> base*o+b[k], s))); #select(isprime, s) }
Comments