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.

Previous Showing 11-20 of 22 results. Next

A372885 Prime numbers whose binary indices (positions of ones in reversed binary expansion) sum to another prime number.

Original entry on oeis.org

2, 3, 11, 23, 29, 41, 43, 61, 71, 79, 89, 101, 103, 113, 131, 137, 149, 151, 163, 181, 191, 197, 211, 239, 269, 271, 281, 293, 307, 331, 349, 353, 373, 383, 401, 433, 457, 491, 503, 509, 523, 541, 547, 593, 641, 683, 701, 709, 743, 751, 761, 773, 827, 863, 887
Offset: 1

Views

Author

Gus Wiseman, May 19 2024

Keywords

Comments

A binary index of n is any position of a 1 in its reversed binary expansion. The binary indices of n are row n of A048793.
The indices of these primes are A372886.

Examples

			The binary indices of 89 are {1,4,5,7}, with sum 17, which is prime, so 89 is in the sequence.
The terms together with their binary expansions and binary indices begin:
    2:         10 ~ {2}
    3:         11 ~ {1,2}
   11:       1011 ~ {1,2,4}
   23:      10111 ~ {1,2,3,5}
   29:      11101 ~ {1,3,4,5}
   41:     101001 ~ {1,4,6}
   43:     101011 ~ {1,2,4,6}
   61:     111101 ~ {1,3,4,5,6}
   71:    1000111 ~ {1,2,3,7}
   79:    1001111 ~ {1,2,3,4,7}
   89:    1011001 ~ {1,4,5,7}
  101:    1100101 ~ {1,3,6,7}
  103:    1100111 ~ {1,2,3,6,7}
  113:    1110001 ~ {1,5,6,7}
  131:   10000011 ~ {1,2,8}
  137:   10001001 ~ {1,4,8}
  149:   10010101 ~ {1,3,5,8}
  151:   10010111 ~ {1,2,3,5,8}
  163:   10100011 ~ {1,2,6,8}
  181:   10110101 ~ {1,3,5,6,8}
  191:   10111111 ~ {1,2,3,4,5,6,8}
  197:   11000101 ~ {1,3,7,8}
		

Crossrefs

For prime instead of binary indices we have A006450, prime case of A316091.
Prime numbers p such that A029931(p) is also prime.
Prime case of A372689.
The indices of these primes are A372886.
A000040 lists the prime numbers, A014499 their binary indices.
A019565 gives Heinz number of binary indices, adjoint A048675.
A058698 counts partitions of prime numbers, strict A064688.
A372687 counts strict partitions of prime binary rank, counted by A372851.
A372688 counts partitions of prime binary rank, with Heinz numbers A277319.
Binary indices:
- listed A048793, sum A029931
- reversed A272020
- opposite A371572, sum A230877
- length A000120, complement A023416
- min A001511, opposite A000012
- max A070939, opposite A070940
- complement A368494, sum A359400
- opposite complement A371571, sum A359359

Programs

  • Maple
    filter:= proc(p)
      local L,i,t;
      L:= convert(p,base,2);
      isprime(add(i*L[i],i=1..nops(L)))
    end proc:
    select(filter, [seq(ithprime(i),i=1..200)]); # Robert Israel, Jun 19 2025
  • Mathematica
    Select[Range[100],PrimeQ[#] && PrimeQ[Total[First/@Position[Reverse[IntegerDigits[#,2]],1]]]&]

A372886 Indices of prime numbers whose binary indices (positions of ones in reversed binary expansion) sum to another prime number.

Original entry on oeis.org

1, 2, 5, 9, 10, 13, 14, 18, 20, 22, 24, 26, 27, 30, 32, 33, 35, 36, 38, 42, 43, 45, 47, 52, 57, 58, 60, 62, 63, 67, 70, 71, 74, 76, 79, 84, 88, 94, 96, 97, 99, 100, 101, 108, 116, 124, 126, 127, 132, 133, 135, 137, 144, 150, 154, 156, 160, 161, 162, 164, 172
Offset: 1

Views

Author

Gus Wiseman, May 19 2024

Keywords

Comments

A binary index of n is any position of a 1 in its reversed binary expansion. The binary indices of n are row n of A048793.
The prime numbers themselves are A372885(n).

Examples

			The binary indices of 89 = prime(24) are {1,4,5,7}, with sum 17, which is prime, so 24 is in the sequence.
		

Crossrefs

Numbers k such that A029931(prime(k)) is prime.
Indices of primes that belong to A372689.
The indexed prime numbers themselves are A372885.
A000040 lists the prime numbers, A014499 their binary indices
A006450 lists primes of prime index, prime case of A316091.
A019565 gives Heinz number of binary indices, adjoint A048675.
A038499 counts partitions of prime length, strict A085756.
Binary indices:
- listed A048793, sum A029931
- reversed A272020
- opposite A371572, sum A230877
- length A000120, complement A023416
- min A001511, opposite A000012
- max A070939, opposite A070940
- complement A368494, sum A359400
- opposite complement A371571, sum A359359
A058698 counts partitions of prime numbers, strict A064688.
A372687 counts strict partitions of prime binary rank, counted by A372851.
A372688 counts partitions of prime binary rank, with Heinz numbers A277319.

Programs

  • Maple
    filter:= proc(p)
      local L,i,t;
      L:= convert(p,base,2);
      isprime(add(i*L[i],i=1..nops(L)))
    end proc:
    select(t -> filter(ithprime(t)), [$1..1000]); # Robert Israel, Jun 19 2025
  • Mathematica
    Select[Range[100],PrimeQ[Total[First /@ Position[Reverse[IntegerDigits[Prime[#],2]],1]]]&]

A372890 Sum of binary ranks of all integer partitions of n, where the binary rank of a partition y is given by Sum_i 2^(y_i-1).

Original entry on oeis.org

0, 1, 4, 10, 25, 52, 115, 228, 471, 931, 1871, 3687, 7373, 14572, 29049, 57694, 115058, 229101, 457392, 912469, 1822945, 3640998, 7277426, 14544436, 29079423, 58137188, 116254386, 232465342, 464889800, 929691662, 1859302291, 3718428513, 7436694889, 14873042016
Offset: 0

Views

Author

Gus Wiseman, May 23 2024

Keywords

Examples

			The partitions of 4 are (4), (3,1), (2,2), (2,1,1), (1,1,1,1), with respective binary ranks 8, 5, 4, 4, 4 with sum 25, so a(4) = 25.
		

Crossrefs

For Heinz number (not binary rank) we have A145519, row sums of A215366.
For Heinz number the strict version is A147655, row sums of A246867.
The strict version is A372888, row sums of A118462.
A005117 gives Heinz numbers of strict integer partitions.
A048675 gives binary rank of prime indices, distinct A087207.
A061395 gives greatest prime index, least A055396.
A118457 lists strict partitions in Mathematica order.
A277905 groups all positive integers by binary rank of prime indices.
Binary indices (A048793):
- length A000120, complement A023416
- min A001511, opposite A000012
- max A029837 or A070939, opposite A070940
- sum A029931, product A096111
- reverse A272020
- complement A368494, sum A359400
- opposite complement A371571, sum A359359
- opposite A371572, sum A230877

Programs

  • Maple
    b:= proc(n, i) option remember; `if`(n=0 or i=1, [1, n],
          b(n, i-1)+(p->[0, p[1]*2^(i-1)]+p)(b(n-i, min(n-i, i))))
        end:
    a:= n-> b(n$2)[2]:
    seq(a(n), n=0..33);  # Alois P. Heinz, May 23 2024
  • Mathematica
    Table[Total[Total[2^(#-1)]&/@IntegerPartitions[n]],{n,0,10}]

Formula

From Alois P. Heinz, May 23 2024: (Start)
a(n) = Sum_{k=1..n} 2^(k-1) * A066633(n,k).
a(n) mod 2 = A365410(n-1) for n>=1. (End)

A119387 a(n) is the number of binary digits (1's and nonleading 0's) which remain unchanged in their positions when n and (n+1) are written in binary.

Original entry on oeis.org

0, 0, 1, 0, 2, 1, 2, 0, 3, 2, 3, 1, 3, 2, 3, 0, 4, 3, 4, 2, 4, 3, 4, 1, 4, 3, 4, 2, 4, 3, 4, 0, 5, 4, 5, 3, 5, 4, 5, 2, 5, 4, 5, 3, 5, 4, 5, 1, 5, 4, 5, 3, 5, 4, 5, 2, 5, 4, 5, 3, 5, 4, 5, 0, 6, 5, 6, 4, 6, 5, 6, 3, 6, 5, 6, 4, 6, 5, 6, 2, 6, 5, 6, 4, 6, 5, 6, 3, 6, 5, 6, 4, 6, 5, 6, 1, 6, 5, 6, 4, 6, 5, 6, 3, 6
Offset: 0

Views

Author

Leroy Quet, Jul 26 2006

Keywords

Comments

The largest k for which A220645(n,k) > 0 is k = a(n). That is, a(n) is the largest power of 2 that divides binomial(n,i) for 0 <= i <= n. - T. D. Noe, Dec 18 2012
a(n) is the distance between the first and last 1's in the binary expansion of n+1; see examples and formulae. - David James Sycamore, Feb 21 2023

Examples

			9 in binary is 1001. 10 (decimal) is 1010 in binary. 2 binary digits remain unchanged (the leftmost two digits) between 1001 and 1010. So a(9) = 2.
From _David James Sycamore_, Feb 26 2023: (Start)
Number of bits surviving transition from n to n+1 = distance between first and last 1's in binary expansion of n+1 (no need to compare n and n+1). Examples:
n = 2^k - 1: distance between 1's in n+1 = 2^k is 0; a(n) = 0 (all bits change).
82 in binary is 1010010, and 83 is 1010011 distance between 1's in 83 = 6 = a(82).
Show visually for a(327) = 5:
 n   = 327 = 101000111
             ^^^^^      5 unchanged bits.
 n+1 = 328 = 101001000
             ^    ^     distance between 1's = 5. (End)
		

Crossrefs

Cf. A070940.
Cf. A000265.
Cf. A373709 (partial sums).

Programs

  • C
    #include 
    #define NMAX 200
    int sameD(int a, int b) { int resul=0 ; while(a>0 && b >0) { if( (a &1) == (b & 1)) resul++ ; a >>= 1 ; b >>= 1 ; } return resul ; }
    int main(int argc, char*argv[])
    { for(int n=0;nR. J. Mathar, Jul 29 2006 */
    
  • C
    int A119387(int n)
    {
        int m=n+1;
        while (!(m&1)) m>>=1;
        int m_bits = 0;
        while (m>>=1) m_bits++;
        return m_bits;
    }
    /* Laura Monroe, Oct 18 2020 */
    
  • Haskell
    a119387 n = length $ takeWhile (< a070940 n) [1..n]
    -- Reinhard Zumkeller, Apr 22 2013
    
  • Maple
    a:= n-> ilog2(n+1)-padic[ordp](n+1, 2):
    seq(a(n), n=0..128);  # Alois P. Heinz, Jun 28 2021
  • Mathematica
    a = {0}; Table[b = IntegerDigits[n, 2]; If[Length[a] == Length[b], c = 1; While[a[[c]] == b[[c]], c++]; c--, c = 0]; a = b; c, {n, 101}] (* T. D. Noe, Dec 18 2012 *)
    (* Second program, faster *)
    Array[Last[#] - First[#] &@ Position[IntegerDigits[#, 2], 1][[All, 1]] &, 2^14] (* Michael De Vlieger, Feb 22 2023 *)
    Table[BitLength[k] - 1 - IntegerExponent[k, 2], {k, 100}] (* Paolo Xausa, Oct 01 2024 *)
  • PARI
    a(n) = n++; local(c); c=0; while(2^(c+1)Ralf Stephan, Oct 16 2013; corrected by Michel Marcus, Jun 28 2021 */
    
  • PARI
    a(n) = my(x=Vecrev(binary(n)), y=Vecrev(binary(n+1))); sum(k=1, min(#x, #y), x[k] == y[k]); \\ Michel Marcus, Jun 27 2021
    
  • PARI
    a(n) = exponent(n+1) - valuation(n+1, 2); \\ Antoine Mathys, Nov 20 2024
    
  • Python
    def A119387(n): return (n+1).bit_length()-(n+1&-n-1).bit_length() # Chai Wah Wu, Jul 07 2022

Formula

a(n) = A048881(n) + A086784(n+1). (A048881(n) is the number of 1's which remain unchanged between binary n and (n+1). A086784(n+1) is the number of nonleading 0's which remain unchanged between binary n and (n+1).)
a(A000225(n))=0. - R. J. Mathar, Jul 29 2006
a(n) = -valuation(H(n)*n,2) where H(n) is the n-th harmonic number. - Benoit Cloitre, Oct 13 2013
a(n) = A000523(n+1) - A007814(n+1) = floor(log(n+1)/log(2)) - valuation(n+1,2). - Benoit Cloitre, Oct 13 2013 [corrected by David James Sycamore, Feb 28 2023]
Recurrence: a(2n) = floor(log_2(n)) except a(0) = 0, a(2n+1) = a(n). - Ralf Stephan, Oct 16 2013, corrected by Peter J. Taylor, Mar 01 2020
a(n) = floor(log_2(A000265(n+1))). - Laura Monroe, Oct 18 2020
a(n) = A070939(n+1) - A001511(n+1). - David James Sycamore, Feb 24 2023

Extensions

More terms from R. J. Mathar, Jul 29 2006
Edited by Charles R Greathouse IV, Aug 04 2010

A372888 Sum of binary ranks of all strict integer partitions of n, where the binary rank of a partition y is given by Sum_i 2^(y_i-1).

Original entry on oeis.org

0, 1, 2, 7, 13, 31, 66, 138, 279, 581, 1173, 2375, 4783, 9630, 19316, 38802, 77689, 155673, 311639, 623845, 1248179, 2497719, 4996387, 9995304, 19992908, 39990902, 79986136, 159983241, 319975073, 639971495, 1279962115, 2559966847, 5119970499, 10240030209
Offset: 0

Views

Author

Gus Wiseman, May 23 2024

Keywords

Examples

			The strict partitions of 6 are (6), (5,1), (4,2), (3,2,1), with respective binary ranks 32, 17, 10, 7 with sum 66, so a(6) = 66.
		

Crossrefs

Row sums of A118462 (binary ranks of strict partitions).
For Heinz number the non-strict version is A145519, row sums of A215366.
For Heinz number (not binary rank) we have A147655, row sums of A246867.
The non-strict version is A372890.
A000009 counts strict partitions, ranks A005117.
A048675 gives binary rank of prime indices, distinct A087207.
A277905 groups all positive integers by binary rank of prime indices.
Binary indices (A048793):
- length A000120, complement A023416
- min A001511, opposite A000012
- max A029837 or A070939, opposite A070940
- sum A029931, product A096111
- reverse A272020
- complement A368494, sum A359400
- opposite A371572, sum A230877
- opposite complement A371571, sum A359359

Programs

  • Maple
    b:= proc(n, i) option remember; `if`(i*(i+1)/2 [0, p[1]*2^(i-1)]
              +p)(b(n-i, min(n-i, i-1)))))
        end:
    a:= n-> b(n$2)[2]:
    seq(a(n), n=0..33);  # Alois P. Heinz, May 23 2024
  • Mathematica
    Table[Total[Total[2^(#-1)]& /@ Select[IntegerPartitions[n],UnsameQ@@#&]],{n,0,10}]

Formula

a(n) = Sum_{k=1..n} 2^(k-1) * A015716(n,k). - Alois P. Heinz, May 24 2024

A372887 Number of integer partitions of n whose distinct parts are the binary indices of some prime number.

Original entry on oeis.org

0, 0, 1, 1, 3, 3, 6, 8, 12, 14, 21, 29, 36, 48, 56, 74, 94, 123, 144, 195, 235, 301, 356, 456, 538, 679, 803, 997, 1189, 1467, 1716, 2103, 2488, 2968, 3517, 4185, 4907, 5834, 6850, 8032, 9459, 11073, 12933, 15130, 17652, 20480, 24011, 27851, 32344, 37520
Offset: 0

Views

Author

Gus Wiseman, May 19 2024

Keywords

Comments

A binary index of n is any position of a 1 in its reversed binary expansion. The binary indices of n are row n of A048793.
Note the inverse of A048793 (binary indices) takes a set s to Sum_i 2^(s_i-1).

Examples

			The partition y = (4,3,1,1) has distinct parts {1,3,4}, which are the binary indices of 13, which is prime, so y is counted under a(9).
The a(2) = 1 through a(9) = 14 partitions:
  (2)  (21)  (22)   (221)   (51)     (331)     (431)      (3321)
             (31)   (311)   (222)    (421)     (521)      (4221)
             (211)  (2111)  (321)    (511)     (2222)     (4311)
                            (2211)   (2221)    (3221)     (5211)
                            (3111)   (3211)    (3311)     (22221)
                            (21111)  (22111)   (4211)     (32211)
                                     (31111)   (5111)     (33111)
                                     (211111)  (22211)    (42111)
                                               (32111)    (51111)
                                               (221111)   (222111)
                                               (311111)   (321111)
                                               (2111111)  (2211111)
                                                          (3111111)
                                                          (21111111)
		

Crossrefs

For odd instead of prime we have A000041, even A002865.
The strict case is A372687, ranks A372851.
Counting not just distinct parts gives A372688, ranks A277319.
These partitions have Heinz numbers A372850.
A014499 lists binary indices of prime numbers.
A019565 gives Heinz number of binary indices, adjoint A048675.
A058698 counts partitions of prime numbers, strict A064688.
A372689 lists numbers whose binary indices sum to a prime.
A372885 lists primes whose binary indices sum to a prime, indices A372886.
Binary indices:
- listed A048793, sum A029931
- reversed A272020
- opposite A371572, sum A230877
- length A000120, complement A023416
- min A001511, opposite A000012
- max A070939, opposite A070940
- complement A368494, sum A359400
- opposite complement A371571, sum A359359

Programs

  • Mathematica
    Table[Length[Select[IntegerPartitions[n], PrimeQ[Total[2^(Union[#]-1)]]&]],{n,0,30}]

A080080 T(n,k) = length of longest carry sequence when adding k to n in binary representation, 1 <= k <= n (triangular array).

Original entry on oeis.org

1, 0, 1, 2, 1, 1, 0, 0, 0, 1, 1, 0, 3, 1, 1, 0, 2, 2, 1, 1, 1, 3, 2, 2, 1, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 2, 0, 1, 0, 4, 1, 1, 0, 1, 1, 0, 0, 3, 3, 1, 1, 1, 2, 1, 1, 0, 4, 3, 3, 1, 2, 1, 1, 0, 0, 0, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 0, 4, 2, 2, 2, 2, 1, 1, 1, 3, 1, 1, 0, 3, 3, 2, 2, 2, 2, 1, 1, 2, 2, 1, 1, 1
Offset: 1

Views

Author

Reinhard Zumkeller, Jan 26 2003

Keywords

Comments

T(n,1) = A007814(n+1), T(n,n) = 1; for n>1: T(n,n-1) = A043545(n+1); T(n,k) <= A070940(n) = T(n, A080079(n)).
T(n,k) = A050600(n+k,k) - 1. - Reinhard Zumkeller, Aug 03 2014

Examples

			Triangle begins:
              1
            0   1
          2   1   1
        0   0   0   1
      1   0   3   1   1
    0   2   2   1   1   1
  3   2   2   1   2   1   1
		

Crossrefs

Cf. A050600.

Programs

  • Haskell
    import Data.Bits (xor, (.&.), shiftL)
    a080080 :: Int -> Int -> Int
    a080080 n k = addc n k 0 where
       addc x y z | y == 0    = z - 1
                  | otherwise = addc (x `xor` y) (shiftL (x .&. y) 1) (z + 1)
    a080080_row n = map (a080080 n) [1..n]
    a080080_tabl = map a080080_row [1..]
    -- Reinhard Zumkeller, Apr 22 2013

A082909 a(n) = Sum_{d|n} (d mod 3).

Original entry on oeis.org

1, 3, 1, 4, 3, 3, 2, 6, 1, 6, 3, 4, 2, 6, 3, 7, 3, 3, 2, 9, 2, 6, 3, 6, 4, 6, 1, 8, 3, 6, 2, 9, 3, 6, 6, 4, 2, 6, 2, 12, 3, 6, 2, 9, 3, 6, 3, 7, 3, 9, 3, 8, 3, 3, 6, 12, 2, 6, 3, 9, 2, 6, 2, 10, 6, 6, 2, 9, 3, 12, 3, 6, 2, 6, 4, 8, 6, 6, 2, 15, 1, 6, 3, 8, 6, 6, 3, 12, 3, 6, 4, 9, 2, 6, 6, 9, 2, 9, 3, 13, 3, 6
Offset: 1

Views

Author

N. J. A. Sloane, Nov 02 2008

Keywords

Comments

The old entry with this sequence number was a duplicate of A070940.

Crossrefs

Programs

  • Mathematica
    Table[Total[Mod[Divisors[n],3]],{n,110}] (* Harvey P. Dale, Jan 01 2019 *)
    Table[DivisorSum[n,Mod[#,3]&],{n,110}] (* Harvey P. Dale, Jan 09 2022 *)

A199570 Table, each row contains the previous sequence in odd columns and the row number in even columns.

Original entry on oeis.org

1, 1, 2, 1, 3, 1, 3, 2, 3, 1, 4, 1, 4, 2, 4, 1, 4, 3, 4, 1, 4, 3, 4, 2, 4, 3, 4, 1, 5, 1, 5, 2, 5, 1, 5, 3, 5, 1, 5, 3, 5, 2, 5, 3, 5, 1, 5, 4, 5, 1, 5, 4, 5, 2, 5, 4, 5, 1, 5, 4, 5, 3, 5, 4, 5, 1, 5, 4, 5, 3, 5, 4, 5, 2, 5, 4, 5, 3, 5, 4, 5
Offset: 1

Views

Author

Keywords

Examples

			The table starts:
  1
  1 2
  1 3 1 3 2 3
  1 4 1 4 2 4 1 4 3 4 1 4 3 4 2 4 3 4
  ...
		

Crossrefs

Cf. A025192 (row lengths), A070940.

Programs

  • PARI
    n=4;v=vector(3^n);v[1]=1;for(k=1,n,for(i=(s=3^(k-1))+1,3^k,v[i]=if((i-s)%2,v[(i-s+1)\2],k+1)));v
    
  • Python
    def A199570_list(row):
        A = [1]
        for i in range(2,row+1):
            z = 2*(3**(i-2))
            for j in range(1,z+1):
                if j%2 != 0: A.append(A[int((j-1)/2)])
                else: A.append(i)
        return(A) # John Tyler Rascoe, Feb 19 2023

A328567 a(n) is the smallest positive integer divisible by n such that it is possible to strike out a digit from its binary expansion (apart from trailing zeros) so that the resulting number is nonzero and divisible by n.

Original entry on oeis.org

3, 6, 21, 12, 75, 42, 105, 24, 279, 150, 341, 84, 403, 210, 465, 48, 1071, 558, 1197, 300, 1323, 682, 1449, 168, 1575, 806, 1701, 420, 1827, 930, 1953, 96, 4191, 2142, 4445, 1116, 4699, 2394, 4953, 600, 5207, 2646, 5461, 1364, 5715, 2898, 5969, 336, 6223, 3150
Offset: 1

Views

Author

Rémy Sigrist, Oct 20 2019

Keywords

Comments

This sequence is a binary variant of A309631.
This kind of sequence is well defined for any fixed base b > 1: for any n > 0: consider the concatenation in base b, say m, of n, "0", and n; m is a multiple of n, and removing the central "0" (which is not a trailing zero), gives another multiple of n.

Examples

			For n = 3:
- the first multiples of 3 are (in decimal and in binary), alongside the possible values resulting from striking out a non-trailing zero:
    3*k  bin(3*k)  striked (binary)
    ---  --------  ----------------
      3        11  1
      6       110  10
      9      1001  1, 100, 101
     12      1100  100
     15      1111  111
     18     10010  10, 1000, 1010
     21     10101  101, 1001, 1010, 1011, 1101
- 21 is the least appropriate multiple,
- so a(3) = 21.
		

Crossrefs

Programs

  • PARI
    See Links section.

Formula

Apparently, a(n)/n = 2^(1+A070940(n)) - 1.
Previous Showing 11-20 of 22 results. Next