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.

Showing 1-4 of 4 results.

A225243 Irregular triangle read by rows, where row n contains the distinct primes that are contained in the binary representation of n as substrings; first row = [1] by convention.

Original entry on oeis.org

1, 2, 3, 2, 2, 5, 2, 3, 3, 7, 2, 2, 2, 5, 2, 3, 5, 11, 2, 3, 2, 3, 5, 13, 2, 3, 7, 3, 7, 2, 2, 17, 2, 2, 3, 19, 2, 5, 2, 5, 2, 3, 5, 11, 2, 3, 5, 7, 11, 23, 2, 3, 2, 3, 2, 3, 5, 13, 2, 3, 5, 11, 13, 2, 3, 7, 2, 3, 5, 7, 13, 29, 2, 3, 7, 3, 7, 31, 2, 2, 2, 17
Offset: 1

Views

Author

Reinhard Zumkeller, Aug 14 2013

Keywords

Comments

Row n = primes in row n of tables A165416 or A119709.

Examples

			.   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___ .
		

Crossrefs

Cf. A078826 (row lengths), A078832 (left edge), A078833 (right edge), A004676, A007088.

Programs

  • Haskell
    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)
    
  • Mathematica
    Array[Union@ Select[FromDigits[#, 2] & /@ Rest@ Subsequences@ IntegerDigits[#, 2], PrimeQ] &, 34] /. {} -> {1} // Flatten (* Michael De Vlieger, Jan 26 2022 *)
  • Python
    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

A078832 Smallest prime contained as binary substring in binary representation of n>1, a(1)=1.

Original entry on oeis.org

1, 2, 3, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
Offset: 1

Views

Author

Reinhard Zumkeller, Dec 08 2002

Keywords

Comments

a(n)<=3 and for n>1: a(n)>=2 and a(n)=3 iff n=2^k-1, k>1.
a(n) = A225243(n,1). - Reinhard Zumkeller, Aug 14 2013

Crossrefs

Programs

Formula

For n > 1: a(n) = A036987(n) + 2. Reinhard Zumkeller, Aug 14 2013

A078834 Greatest prime factor of n also contained as binary substring in binary representation of n; a(n)=1, if no such factor exists.

Original entry on oeis.org

1, 2, 3, 2, 5, 3, 7, 2, 1, 5, 11, 3, 13, 7, 3, 2, 17, 2, 19, 5, 1, 11, 23, 3, 1, 13, 3, 7, 29, 3, 31, 2, 1, 17, 1, 2, 37, 19, 3, 5, 41, 2, 43, 11, 5, 23, 47, 3, 1, 2, 3, 13, 53, 3, 11, 7, 3, 29, 59, 3, 61, 31, 7, 2, 1, 2, 67, 17, 1, 2, 71, 2, 73, 37, 5, 19, 1, 3, 79, 5, 1, 41, 83, 2, 5, 43
Offset: 1

Views

Author

Reinhard Zumkeller, Dec 08 2002

Keywords

Comments

a(n) <= min{A078833(n), A006530(n)};
for n>1: a(n) = n iff n is prime.
a(A100484(n)) = A000040(n); a(A100368(n)) = A006530(A100368(n)). [Reinhard Zumkeller, Sep 19 2011]

Examples

			n=15=3*5 has two factors; only '11'=3 is contained in '1111'=15, therefore a(15)=3.
		

Crossrefs

Programs

  • Haskell
    import Numeric (showIntAtBase)
    import Data.List (find, isInfixOf)
    import Data.Maybe (fromMaybe)
    a078834 n = fromMaybe 1 $ find (\p -> showIntAtBase 2 ("01" !!) p ""
                              `isInfixOf` showIntAtBase 2 ("01" !!) n "") $
                     reverse $ a027748_row n
    -- Reinhard Zumkeller, Sep 19 2011
  • Mathematica
    a[n_] := Module[{bn, pp, sel}, bn = IntegerDigits[n, 2]; pp = FactorInteger[n][[All, 1]]; sel = Select[pp, MatchQ[bn, {_, Sequence @@ IntegerDigits[#, 2], _}] &]; If[sel == {}, 1, Max[sel]]]; Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Aug 13 2013 *)

A303077 a(1) = 1, and for n > 1, a(n) is the greatest prime number whose binary digits appear in order but not necessarily as consecutive digits in the binary representation of n.

Original entry on oeis.org

1, 2, 3, 2, 5, 3, 7, 2, 5, 5, 11, 3, 13, 7, 7, 2, 17, 5, 19, 5, 13, 11, 23, 3, 13, 13, 13, 7, 29, 7, 31, 2, 17, 17, 19, 5, 37, 19, 23, 5, 41, 13, 43, 11, 29, 23, 47, 3, 17, 13, 19, 13, 53, 13, 31, 7, 29, 29, 59, 7, 61, 31, 31, 2, 17, 17, 67, 17, 37, 19, 71, 5
Offset: 1

Views

Author

Rémy Sigrist, Apr 18 2018

Keywords

Comments

This sequence has similarities with A078833; there binary digits have to be consecutive, here not.
For n > 1, a(n) is the greatest prime number appearing in the n-th row of A301983.

Examples

			The first terms, alongside the binary representations of n and of a(n), are:
  n   a(n)  bin(n)  bin(a(n))
  --  ----  ------  ---------
   1     1       1       1
   2     2      10      10
   3     3      11      11
   4     2     100     10_
   5     5     101     101
   6     3     110     11_
   7     7     111     111
   8     2    1000    10__
   9     5    1001    10_1
  10     5    1010    101_
  11    11    1011    1011
  12     3    1100    11__
  13    13    1101    1101
  14     7    1110    111_
  15     7    1111    111_
		

Crossrefs

Programs

  • PARI
    a(n) = my (s=Set(1), b=binary(n)); for (i=2, #b, s=setunion(s, Set(apply(k->2*k+b[i], s)))); vecmax(select(k->k==1 || isprime(k), s))

Formula

a(2*n) = a(n) for any n > 1.
a(n) = n iff n is not composite.
a(n) = 2 iff n = 2^k for some k > 0.
a(n) >= A078833(n).
Showing 1-4 of 4 results.