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-10 of 30 results. Next

A319023 Let S be the sequence generated by these rules: 1 is in S, and if k is in S, then A057168(k) and A319021(k) are in S, and duplicates are deleted as they occur; a(n) is the n-th term of S.

Original entry on oeis.org

1, 2, 3, 4, 5, 9, 8, 6, 7, 10, 27, 16, 14, 11, 12, 29, 81, 32, 20, 19, 13, 17, 18, 30, 31, 82, 243, 64, 34, 24, 22, 21, 15, 23, 28, 39, 36, 47, 33, 84, 245, 729, 128, 66, 38, 25, 35, 43, 45, 40, 54, 55, 49, 37, 88, 90, 246, 247, 730, 2187, 256, 130, 68, 72, 41
Offset: 1

Views

Author

Rémy Sigrist, Sep 08 2018

Keywords

Comments

This sequence is a permutation of the natural numbers (with inverse A319024):
- this sequence is injective,
- this sequence is surjective: by contradiction:
- let m be the least integer missing from the sequence,
- as a(1) = 1, we have m > 1,
- also, m belongs to A000225 and to A062318,
- however the only positive integer belonging to both sequences is 1,
- hence a contradiction, QED.

Examples

			The first terms, alongside b(n) = A057168(a(n)) and t(n) = A319021(a(n)), are:
  n   a(n)  b(n)  t(n)
  --  ----  ----  ----
   1     1     2     3
   2     2     4     4
   3     3     5     9
   4     4     8     6
   5     5     6     7
   6     9    10    27
   7     8    16    14
   8     6     9    10
   9     7    11    11
  10    10    12    12
  11    27    29    81
  12    16    32    20
  13    14    19    16
  14    11    13    13
  15    12    17    18
  16    29    30    31
  17    81    82   243
  18    32    64    34
  19    20    24    22
  20    19    21    21
		

Crossrefs

Programs

  • PARI
    See Links section.

A018900 Sums of two distinct powers of 2.

Original entry on oeis.org

3, 5, 6, 9, 10, 12, 17, 18, 20, 24, 33, 34, 36, 40, 48, 65, 66, 68, 72, 80, 96, 129, 130, 132, 136, 144, 160, 192, 257, 258, 260, 264, 272, 288, 320, 384, 513, 514, 516, 520, 528, 544, 576, 640, 768, 1025, 1026, 1028, 1032, 1040, 1056, 1088, 1152, 1280, 1536, 2049, 2050, 2052, 2056, 2064, 2080, 2112, 2176, 2304, 2560, 3072
Offset: 1

Views

Author

Jonn Dalton (jdalton(AT)vnet.ibm.com), Dec 11 1996

Keywords

Comments

Appears to give all k such that 8 is the highest power of 2 dividing A005148(k). - Benoit Cloitre, Jun 22 2002
Seen as a triangle read by rows, T(n,k) = 2^(k-1) + 2^n, 1 <= k <= n, the sum of the n-th row equals A087323(n). - Reinhard Zumkeller, Jun 24 2009
Numbers whose base-2 sum of digits is 2. - Tom Edgar, Aug 31 2013
All odd terms are A000051. - Robert G. Wilson v, Jan 03 2014
A239708 holds the subsequence of terms m such that m - 1 is prime. - Hieronymus Fischer, Apr 20 2014

Examples

			From _Hieronymus Fischer_, Apr 27 2014: (Start)
a(1) = 3, since 3 = 2^1 + 2^0.
a(5) = 10, since 10 = 2^3 + 2^1.
a(10^2) = 16640
a(10^3) = 35184372089344
a(10^4) = 2788273714550169769618891533295908724670464 = 2.788273714550...*10^42
a(10^5) = 3.6341936214780344527466190...*10^134
a(10^6) = 4.5332938264998904048012398...*10^425
a(10^7) = 1.6074616084721302346802429...*10^1346
a(10^8) = 1.4662184497310967196301632...*10^4257
a(10^9) = 2.3037539289782230932863807...*10^13462
a(10^10) = 9.1836811272250798973464436...*10^42571
(End)
		

Crossrefs

Cf. A000079, A014311, A014312, A014313, A023688, A023689, A023690, A023691 (Hamming weight = 1, 3, 4, ..., 9).
Sum of base-b digits equal b: A226636 (b = 3), A226969 (b = 4), A227062 (b = 5), A227080 (b = 6), A227092 (b = 7), A227095 (b = 8), A227238 (b = 9), A052224 (b = 10). - M. F. Hasler, Dec 23 2016

Programs

  • C
    unsigned hakmem175(unsigned x) {
        unsigned s, o, r;
        s = x & -x; r = x + s;
        o = x ^ r;  o = (o >> 2) / s;
        return r | o;
    }
    unsigned A018900(int n) {
        if (n == 1) return 3;
        return hakmem175(A018900(n - 1));
    } // Peter Luschny, Jan 01 2014
    
  • Haskell
    a018900 n = a018900_list !! (n-1)
    a018900_list = elemIndices 2 a073267_list  -- Reinhard Zumkeller, Mar 07 2012
    
  • Maple
    a:= n-> (i-> 2^i+2^(n-1-i*(i-1)/2))(floor((sqrt(8*n-1)+1)/2)):
    seq(a(n), n=1..100);  # Alois P. Heinz, Feb 01 2022
  • Mathematica
    Select[ Range[ 1056 ], (Count[ IntegerDigits[ #, 2 ], 1 ]==2)& ]
    Union[Total/@Subsets[2^Range[0,10],{2}]] (* Harvey P. Dale, Mar 04 2012 *)
  • PARI
    for(m=1,9,for(n=0,m-1,print1(2^m+2^n", "))) \\ Charles R Greathouse IV, Sep 09 2011
    
  • PARI
    is(n)=hammingweight(n)==2 \\ Charles R Greathouse IV, Mar 03 2014
    
  • PARI
    for(n=0,10^5,if(hammingweight(n)==2,print1(n,", "))); \\ Joerg Arndt, Mar 04 2014
    
  • PARI
    a(n)= my(t=sqrtint(n*8)\/2); 2^t + 2^(n-1-t*(t-1)/2); \\ Ruud H.G. van Tol, Nov 30 2024
    
  • Python
    print([n for n in range(1, 3001) if bin(n)[2:].count("1")==2]) # Indranil Ghosh, Jun 03 2017
    
  • Python
    A018900_list = [2**a+2**b for a in range(1,10) for b in range(a)] # Chai Wah Wu, Jan 24 2021
    
  • Python
    from math import isqrt, comb
    def A018900(n): return (1<<(m:=isqrt(n<<3)+1>>1))+(1<<(n-1-comb(m,2))) # Chai Wah Wu, Oct 30 2024
  • Smalltalk
    distinctPowersOf: b
      "Version 1: Answers the n-th number of the form b^i + b^j, i>j>=0, where n is the receiver.
      b > 1 (b = 2, for this sequence).
      Usage: n distinctPowersOf: 2
      Answer: a(n)"
      | n i j |
      n := self.
      i := (8*n - 1) sqrtTruncated + 1 // 2.
      j := n - (i*(i - 1)/2) - 1.
      ^(b raisedToInteger: i) + (b raisedToInteger: j)
    [by Hieronymus Fischer, Apr 20 2014]
    ------------
    
  • Smalltalk
    distinctPowersOf: b
      "Version 2: Answers an array which holds the first n numbers of the form b^i + b^j, i>j>=0, where n is the receiver. b > 1 (b = 2, for this sequence).
      Usage: n distinctPowersOf: 2
      Answer: #(3 5 6 9 10 12 ...) [first n terms]"
      | k p q terms |
      terms := OrderedCollection new.
      k := 0.
      p := b.
      q := 1.
      [k < self] whileTrue:
             [[q < p and: [k < self]] whileTrue:
                       [k := k + 1.
                       terms add: p + q.
                       q := b * q].
             p := b * p.
             q := 1].
      ^terms as Array
    [by Hieronymus Fischer, Apr 20 2014]
    ------------
    
  • Smalltalk
    floorDistinctPowersOf: b
      "Answers an array which holds all the numbers b^i + b^j < n, i>j>=0, where n is the receiver.
      b > 1 (b = 2, for this sequence).
      Usage: n floorDistinctPowersOf: 2
      Answer: #(3 5 6 9 10 12 ...) [all terms < n]"
      | a n p q terms |
      terms := OrderedCollection new.
      n := self.
      p := b.
      q := 1.
      a := p + q.
      [a < n] whileTrue:
             [[q < p and: [a < n]] whileTrue:
                       [terms add: a.
                       q := b * q.
                       a := p + q].
             p := b * p.
             q := 1.
             a := p + q].
      ^terms as Array
    [by Hieronymus Fischer, Apr 20 2014]
    ------------
    
  • Smalltalk
    invertedDistinctPowersOf: b
      "Given a number m which is a distinct power of b, this method answers the index n such that there are uniquely defined i>j>=0 for which b^i + b^j = m, where m is the receiver;  b > 1 (b = 2, for this sequence).
      Usage: m invertedDistinctPowersOf: 2
      Answer: n such that a(n) = m, or, if no such n exists, min (k | a(k) >= m)"
      | n i j k m |
      m := self.
      i := m integerFloorLog: b.
      j := m - (b raisedToInteger: i) integerFloorLog: b.
      n := i * (i - 1) / 2 + 1 + j.
      ^n
    [by Hieronymus Fischer, Apr 20 2014]
    

Formula

a(n) = 2^trinv(n-1) + 2^((n-1)-((trinv(n-1)*(trinv(n-1)-1))/2)), i.e., 2^A002024(n)+2^A002262(n-1). - Antti Karttunen
a(n) = A059268(n-1) + A140513(n-1). A000120(a(n)) = 2. Complement of A161989. A151774(a(n)) = 1. - Reinhard Zumkeller, Jun 24 2009
A073267(a(n)) = 2. - Reinhard Zumkeller, Mar 07 2012
Start with A000051. If n is in sequence, then so is 2n. - Ralf Stephan, Aug 16 2013
a(n) = A057168(a(n-1)) for n>1 and a(1) = 3. - Marc LeBrun, Jan 01 2014
From Hieronymus Fischer, Apr 20 2014: (Start)
Formulas for a general parameter b according to a(n) = b^i + b^j, i>j>=0; b = 2 for this sequence.
a(n) = b^i + b^j, where i = floor((sqrt(8n - 1) + 1)/2), j = n - 1 - i*(i - 1)/2 [for a Smalltalk implementation see Prog section, method distinctPowersOf: b (2 versions)].
a(A000217(n)) = (b + 1)*b^(n-1) = b^n + b^(n-1).
a(A000217(n)+1) = 1 + b^(n+1).
a(n + 1 + floor((sqrt(8n - 1) + 1)/2)) = b*a(n).
a(n + 1 + floor(log_b(a(n)))) = b*a(n).
a(n + 1) = b^2/(b+1) * a(n) + 1, if n is a triangular number (s. A000217).
a(n + 1) = b*a(n) + (1-b)* b^floor((sqrt(8n - 1) + 1)/2), if n is not a triangular number.
The next term can also be calculated without using the index n. Let m be a term and i = floor(log_b(m)), then:
a(n + 1) = b*m + (1-b)* b^i, if floor(log_b(m/(b+1))) + 1 < i,
a(n + 1) = b^2/(b+1) * m + 1, if floor(log_b(m/(b+1))) + 1 = i.
Partial sum:
Sum_{k=1..n} a(k) = ((((b-1)*(j+1)+i-1)*b^(i-j) + b)*b^j - i)/(b-1), where i = floor((sqrt(8*n - 1) + 1)/2), j = n - 1 - i*(i - 1)/2.
Inverse:
For each sequence term m, the index n such that a(n) = m is determined by n := i*(i-1)/2 + j + 1, where i := floor(log_b(m)), j := floor(log_b(m - b^floor(log_b(m)))) [for a Smalltalk implementation see Prog section, method invertedDistinctPowersOf: b].
Inequalities:
a(n) <= (b+1)/b * b^floor(sqrt(2n)+1/2), equality holds for triangular numbers.
a(n) > b^floor(sqrt(2n)+1/2).
a(n) < b^sqrt(2n)*sqrt(b).
a(n) > b^sqrt(2n)/sqrt(b).
Asymptotic behavior:
lim sup a(n)/b^sqrt(2n) = sqrt(b).
lim inf a(n)/b^sqrt(2n) = 1/sqrt(b).
lim sup a(n)/b^(floor(sqrt(2n))) = b.
lim inf a(n)/b^(floor(sqrt(2n))) = 1.
lim sup a(n)/b^(floor(sqrt(2n)+1/2)) = (b+1)/b.
lim inf a(n)/b^(floor(sqrt(2n)+1/2)) = 1.
(End)
Sum_{n>=1} 1/a(n) = A179951. - Amiram Eldar, Oct 06 2020

Extensions

Edited by M. F. Hasler, Dec 23 2016

A014311 Numbers with exactly 3 ones in binary expansion.

Original entry on oeis.org

7, 11, 13, 14, 19, 21, 22, 25, 26, 28, 35, 37, 38, 41, 42, 44, 49, 50, 52, 56, 67, 69, 70, 73, 74, 76, 81, 82, 84, 88, 97, 98, 100, 104, 112, 131, 133, 134, 137, 138, 140, 145, 146, 148, 152, 161, 162, 164, 168, 176, 193, 194, 196, 200, 208, 224, 259, 261, 262, 265, 266, 268, 273, 274, 276, 280, 289, 290, 292, 296, 304
Offset: 1

Views

Author

Al Black (gblack(AT)nol.net)

Keywords

Comments

Equivalently, sums of three distinct powers of 2.
Appears to give all n such that 64 is the highest power of 2 dividing A005148(n). - Benoit Cloitre, Jun 22 2002
From Gus Wiseman, Oct 05 2020: (Start)
These are numbers k such that the k-th composition in standard order has length 3. The k-th composition in standard order (graded reverse-lexicographic, A066099) is obtained by taking the set of positions of 1's in the reversed binary expansion of k, prepending 0, taking first differences, and reversing again. This gives a bijective correspondence between nonnegative integers and integer compositions. The sequence together with the corresponding standard compositions begins:
7: (1,1,1) 44: (2,1,3) 97: (1,5,1)
11: (2,1,1) 49: (1,4,1) 98: (1,4,2)
13: (1,2,1) 50: (1,3,2) 100: (1,3,3)
14: (1,1,2) 52: (1,2,3) 104: (1,2,4)
19: (3,1,1) 56: (1,1,4) 112: (1,1,5)
21: (2,2,1) 67: (5,1,1) 131: (6,1,1)
22: (2,1,2) 69: (4,2,1) 133: (5,2,1)
25: (1,3,1) 70: (4,1,2) 134: (5,1,2)
26: (1,2,2) 73: (3,3,1) 137: (4,3,1)
28: (1,1,3) 74: (3,2,2) 138: (4,2,2)
35: (4,1,1) 76: (3,1,3) 140: (4,1,3)
37: (3,2,1) 81: (2,4,1) 145: (3,4,1)
38: (3,1,2) 82: (2,3,2) 146: (3,3,2)
41: (2,3,1) 84: (2,2,3) 148: (3,2,3)
42: (2,2,2) 88: (2,1,4) 152: (3,1,4)
(End)

Crossrefs

Cf. A038465 (base 3), A038471 (base 4), A038475 (base 5).
Cf. A081091 (primes), A212190 (squares), A212192 (triangular numbers), A173589 (Fibbinary).
Cf. A057168.
Cf. A000079, A018900, A014311, A014312, A014313, A023688, A023689, A023690, A023691 (Hammingweight = 1, 2, ..., 9).
A000217(n-2) counts compositions into three parts.
A001399(n-3) = A069905(n) = A211540(n+2) counts the unordered case.
A001399(n-6) = A069905(n-3) = A211540(n-1) counts the unordered strict case.
A001399(n-6)*6 = A069905(n-3)*6 = A211540(n-1)*6 counts the strict case.
A014612 is an unordered version, with strict case A007304.
A337453 is the strict case.
A337461 counts the coprime case.
A033992 lists numbers divisible by exactly three different primes.
A323024 lists numbers with exactly three different prime multiplicities.

Programs

  • C
    unsigned hakmem175(unsigned x) {
        unsigned s, o, r;
        s = x & -x;  r = x + s;
        o = r ^ x;  o = (o >> 2) / s;
        return r | o;
    }
    unsigned A014311(int n) {
        if (n == 1) return 7;
        return hakmem175(A014311(n - 1));
    }  // Peter Luschny, Jan 01 2014
    
  • Haskell
    a014311 n = a014311_list !! (n-1)
    a014311_list = [2^x + 2^y + 2^z |
                    x <- [2..], y <- [1..x-1], z <- [0..y-1]]
    -- Reinhard Zumkeller, May 03 2012
    
  • Mathematica
    Select[Range[200], (Count[IntegerDigits[#, 2], 1] == 3)&]
    nn = 8; Flatten[Table[2^i + 2^j + 2^k, {i, 2, nn}, {j, 1, i - 1}, {k, 0, j - 1}]] (* T. D. Noe, Nov 05 2013 *)
  • PARI
    for(n=0,10^3,if(hammingweight(n)==3,print1(n,", "))); \\ Joerg Arndt, Mar 04 2014
    
  • PARI
    print1(t=7);for(i=2,50,print1(","t=A057168(t))) \\ M. F. Hasler, Aug 27 2014
    
  • Python
    A014311_list = [2**a+2**b+2**c for a in range(2,6) for b in range(1,a) for c in range(b)] # Chai Wah Wu, Jan 24 2021
    
  • Python
    from itertools import islice
    def A014311_gen(): # generator of terms
        yield (n:=7)
        while True: yield (n:=n^((a:=-n&n+1)|(a>>1)) if n&1 else ((n&~(b:=n+(a:=n&-n)))>>a.bit_length())^b)
    A014311_list = list(islice(A014311_gen(),20)) # Chai Wah Wu, Mar 10 2025
    
  • Python
    from math import isqrt, comb
    from sympy import integer_nthroot
    def A014311(n): return (1<<(r:=n-1-comb((m:=integer_nthroot(6*n,3)[0])+(t:=(n>comb(m+2,3)))+1,3))-comb((k:=isqrt(b:=r+1<<1))+(b>k*(k+1)),2))+(1<<(a:=isqrt(s:=n-comb(m-(t^1)+2,3)<<1))+((s<<2)>(a<<2)*(a+1)+1))+(1<Chai Wah Wu, Mar 10 2025

Formula

A000120(a(n)) = 3. - Reinhard Zumkeller, May 03 2012
Start with A084468. If n is in sequence, then 2n is too. - Ralf Stephan, Aug 16 2013
a(n+1) = A057168(a(n)). - M. F. Hasler, Aug 27 2014
a(n) = 2^A056558(n-1) + 2^A194848(n-1) + 2^A194847(n-1). - Ridouane Oudra, Sep 06 2020
Sum_{n>=1} 1/a(n) = A367110 = 1.428591545852638123996854844400537952781688750906133068397189529775365950039... (calculated using Baillie's irwinSums.m, see Links). - Amiram Eldar, Feb 14 2022

Extensions

Extension and program by Olivier Gérard

A014312 Numbers with exactly 4 ones in binary expansion.

Original entry on oeis.org

15, 23, 27, 29, 30, 39, 43, 45, 46, 51, 53, 54, 57, 58, 60, 71, 75, 77, 78, 83, 85, 86, 89, 90, 92, 99, 101, 102, 105, 106, 108, 113, 114, 116, 120, 135, 139, 141, 142, 147, 149, 150, 153, 154, 156, 163, 165, 166, 169, 170, 172, 177, 178, 180, 184, 195, 197
Offset: 1

Views

Author

Al Black (gblack(AT)nol.net)

Keywords

Crossrefs

Cf. A090706.
Cf. A000079, A018900, A014311, A014313, A023688, A023689, A023690, A023691 (Hamming weight = 1, 2, ..., 9), A057168.

Programs

  • Mathematica
    Select[ Range[ 180 ], (Count[ IntegerDigits[ #, 2 ], 1 ]==4)& ] (* Olivier Gérard *)
  • PARI
    for(n=0,10^3,if(hammingweight(n)==4,print1(n,", "))); \\ Joerg Arndt, Mar 04 2014
    
  • PARI
    print1(t=15); for(i=2, 50, print1(", "t=A057168(t))) \\ M. F. Hasler, Aug 27 2014
    
  • Perl
    $N = 4;
    my $vector = 2 ** $N - 1;  # first key (15)
    for (1..100) {
      print "$vector, ";
      my ($v, $d) = ($vector, 0);
      until ($v & 1 or !$v) { $d = ($d << 1)|1; $v >>= 1 }
      $vector += $d + 1 + (($v ^ ($v + 1)) >> 2);  # next key
    } # Ruud H.G. van Tol, Mar 02 2014
    
  • Python
    A014312_list = [2**a+2**b+2**c+2**d for a in range(3,6) for b in range(2,a) for c in range(1,b) for d in range(c)] # Chai Wah Wu, Jan 24 2021
    
  • Python
    from itertools import islice
    def A014312_gen(): # generator of terms
        yield (n:=15)
        while True: yield (n:=n^((a:=-n&n+1)|(a>>1)) if n&1 else ((n&~(b:=n+(a:=n&-n)))>>a.bit_length())^b)
    A014312_list = list(islice(A014312_gen(),20)) # Chai Wah Wu, Mar 10 2025
    
  • Rust
    pub const fn next_choice(value: usize) -> usize {
      // Passing a term will return the next number in the sequence
      let zeros = value.trailing_zeros();
      let ones = (value >> zeros).trailing_ones();
      value + (1 << zeros) + (1 << (ones - 1)) - 1
    } // Andrew Bennett, Jan 07 2022

Formula

a(n+1) = A057168(a(n)). - M. F. Hasler, Aug 27 2014
a(n) = 2^A194882(n-1) + 2^A194883(n-1) + 2^A194884(n-1) + 2^A127324(n-1). - Ridouane Oudra, Sep 06 2020
Sum_{n>=1} 1/a(n) = 1.399770961748474333075618147113153558623203796657745865012742162098738541849... (calculated using Baillie's irwinSums.m, see Links). - Amiram Eldar, Feb 14 2022

Extensions

Extension by Olivier Gérard

A014313 Numbers with exactly 5 ones in binary expansion.

Original entry on oeis.org

31, 47, 55, 59, 61, 62, 79, 87, 91, 93, 94, 103, 107, 109, 110, 115, 117, 118, 121, 122, 124, 143, 151, 155, 157, 158, 167, 171, 173, 174, 179, 181, 182, 185, 186, 188, 199, 203, 205, 206, 211, 213, 214, 217, 218, 220, 227, 229, 230, 233, 234, 236, 241, 242
Offset: 1

Views

Author

Al Black (gblack(AT)nol.net)

Keywords

Comments

Appears to give all n such that 4096 is the highest power of 2 dividing A005148(n). - Benoit Cloitre, Jun 22 2002

Crossrefs

Cf. A000079, A018900, A014311, A014312, A023688, A023689, A023690, A023691 (Hamming weight = 1, 2, ..., 9).

Programs

  • Haskell
    a014313 = f . a038447 where
       f x = if x == 0 then 0 else 2 * f x' + b  where (x', b) = divMod x 10
    -- Reinhard Zumkeller, Jan 06 2015
    
  • Mathematica
    Select[ Range[31, 240], Total[IntegerDigits[#, 2]] == 5&]
  • PARI
    sum_of_bits(n) = if(n<1, 0, sum_of_bits(floor(n/2))+n%2)
    isA014313(n) = (sum_of_bits(n) == 5); \\ Michael B. Porter, Oct 21 2009
    
  • PARI
    is(n)=hammingweight(n)==5 \\ Charles R Greathouse IV, Nov 17 2013
    
  • PARI
    print1(t=2^5-1); for(i=2, 50, print1(", "t=A057168(t))) \\ M. F. Hasler, Aug 27 2014
    
  • Python
    from itertools import islice
    def A014313_gen(): # generator of terms
        yield (n:=31)
        while True: yield (n:=((n&~(b:=n+(a:=n&-n)))>>a.bit_length())^b)
    A014313_list = list(islice(A014313_gen(),30)) # Chai Wah Wu, Mar 06 2025

Formula

a(n+1) = A057168(a(n)). - M. F. Hasler, Aug 27 2014
A038447(n) = A007088(a(n)). - Reinhard Zumkeller, Jan 06 2015
Sum_{n>=1} 1/a(n) = 1.390704528210321982529622080740025763242354253694629591331835888395977392151... (calculated using Baillie's irwinSums.m, see Links). - Amiram Eldar, Feb 14 2022

Extensions

Extension and program by Olivier Gérard

A023689 Numbers with exactly 7 ones in binary expansion.

Original entry on oeis.org

127, 191, 223, 239, 247, 251, 253, 254, 319, 351, 367, 375, 379, 381, 382, 415, 431, 439, 443, 445, 446, 463, 471, 475, 477, 478, 487, 491, 493, 494, 499, 501, 502, 505, 506, 508, 575, 607, 623, 631, 635, 637, 638, 671, 687
Offset: 1

Views

Author

Keywords

Crossrefs

Cf. A000079, A018900, A014311, A014312, A014313, A023688, A023690, A023691 (Hamming weight = 1, 2, ..., 9), A057168.

Programs

  • Mathematica
    Select[ Range[ 127, 704 ], (Count[ IntegerDigits[ #, 2 ], 1 ]==7)& ]
  • PARI
    is_A023689(n)=hammingweight(n)==7 \\ M. F. Hasler, Aug 27 2014
    
  • PARI
    print1(t=2^7-1); for(i=2, 50, print1(", "t=A057168(t))) \\ M. F. Hasler, Aug 27 2014
    
  • Python
    from itertools import islice
    def A023689_gen(): # generator of terms
        yield (n:=127)
        while True: yield (n:=((n&~(b:=n+(a:=n&-n)))>>a.bit_length())^b)
    A023689_list =  list(islice(A023689_gen(),30)) # Chai Wah Wu, Mar 06 2025

Formula

a(n+1) = A057168(a(n)). - M. F. Hasler, Aug 27 2014
Sum_{n>=1} 1/a(n) = 1.386779022721502147026318489565477811900220906277367947393004721391094590038... (calculated using Baillie's irwinSums.m, see Links). - Amiram Eldar, Feb 14 2022

A023690 Numbers with exactly 8 ones in binary expansion.

Original entry on oeis.org

255, 383, 447, 479, 495, 503, 507, 509, 510, 639, 703, 735, 751, 759, 763, 765, 766, 831, 863, 879, 887, 891, 893, 894, 927, 943, 951, 955, 957, 958, 975, 983, 987, 989, 990, 999, 1003, 1005, 1006, 1011, 1013, 1014, 1017
Offset: 1

Views

Author

Keywords

Crossrefs

Cf. A000079, A018900, A014311, A014312, A014313, A023688, A023689, A023691 (Hamming weight = 1, 2, ..., 9), A057168.

Programs

  • Mathematica
    Select[ Range[ 255, 1024 ], (Count[ IntegerDigits[ #, 2 ], 1 ]==8)& ]
  • PARI
    is_A023690(n)=hammingweight(n)==8 \\ M. F. Hasler, Aug 27 2014
    
  • PARI
    print1(t=2^8-1); for(i=2, 50, print1(", "t=A057168(t))) \\ M. F. Hasler, Aug 27 2014
    
  • Python
    from itertools import count, islice
    def A023690_gen(): # generator of terms
        n = 255
        while True:
            yield n
            n = ((n&~(b:=n+(a:=n&-n)))>>a.bit_length())^b
    A023690_list = list(islice(A023690_gen(),30)) # Chai Wah Wu, Mar 06 2025

Formula

a(n+1) = A057168(a(n)). - M. F. Hasler, Aug 27 2014
Sum_{n>=1} 1/a(n) = 1.386455689748809038407077281583569975813437283445124123432573411446506561062... (calculated using Baillie's irwinSums.m, see Links). - Amiram Eldar, Feb 14 2022

A023688 Numbers with exactly 6 ones in binary expansion.

Original entry on oeis.org

63, 95, 111, 119, 123, 125, 126, 159, 175, 183, 187, 189, 190, 207, 215, 219, 221, 222, 231, 235, 237, 238, 243, 245, 246, 249, 250, 252, 287, 303, 311, 315, 317, 318, 335, 343, 347, 349, 350, 359, 363, 365, 366, 371, 373
Offset: 1

Views

Author

Keywords

Comments

Sequence appears to include all numbers m such that 8^5 is the highest power of 2 dividing A005148(m). General conjecture: numbers k such that 8^j is the highest power of 2 dividing A005148(k) is the same sequence as numbers having exactly (j+1) 1's in their binary representation. - Benoit Cloitre, Jun 22 2002

Crossrefs

Cf. A000079, A018900, A014311, A014312, A014313, A023689, A023690, A023691 (Hamming weight = 1..9).

Programs

  • Mathematica
    Select[ Range[ 63, 380 ], (Count[ IntegerDigits[ #, 2 ], 1 ]==6)& ]
  • PARI
    is_A023688(n)=hammingweight(n)==6 \\ M. F. Hasler, Aug 27 2014
    
  • PARI
    print1(t=2^6-1); for(i=2, 50, print1(", "t=A057168(t))) \\ M. F. Hasler, Aug 27 2014
    
  • Python
    from itertools import islice
    def A023688_gen(): # generator of terms
        yield (n:=63)
        while True: yield (n:=((n&~(b:=n+(a:=n&-n)))>>a.bit_length())^b)
    A023688_list = list(islice(A023688_gen(),30)) # Chai Wah Wu, Mar 06 2025

Formula

a(n+1) = A057168(a(n)). - M. F. Hasler, Aug 27 2014
Sum_{n>=1} 1/a(n) = 1.387753111935705074750004158584017188750706394077047633137401652680870607884... (calculated using Baillie's irwinSums.m, see Links). - Amiram Eldar, Feb 14 2022

A023691 Numbers with exactly 9 ones in binary expansion.

Original entry on oeis.org

511, 767, 895, 959, 991, 1007, 1015, 1019, 1021, 1022, 1279, 1407, 1471, 1503, 1519, 1527, 1531, 1533, 1534, 1663, 1727, 1759, 1775, 1783, 1787, 1789, 1790, 1855, 1887, 1903, 1911, 1915, 1917, 1918, 1951, 1967, 1975
Offset: 1

Views

Author

Keywords

Crossrefs

Cf. A000079, A018900, A014311, A014312, A014313, A023688, A023689, A023690 (Hamming weight = 1, 2, ..., 8), A057168.

Programs

  • Mathematica
    Select[ Range[ 511, 2048 ], (Count[ IntegerDigits[ #, 2 ], 1 ]==9)& ]
  • PARI
    is_A023691(n)=hammingweight(n)==9 \\ M. F. Hasler, Aug 27 2014
    
  • PARI
    print1(t=2^9-1); for(i=2, 50, print1(", "t=A057168(t))) \\ M. F. Hasler, Aug 27 2014
    
  • Python
    from itertools import islice
    def A023691_gen(): # generator of terms
        yield (n:=511)
        while True: yield (n:=((n&~(b:=n+(a:=n&-n)))>>a.bit_length())^b)
    A023691_list = list(islice(A023691_gen(),30)) # Chai Wah Wu, Mar 06 2025

Formula

a(n+1) = A057168(a(n)). - M. F. Hasler, Aug 27 2014
Sum_{n>=1} 1/a(n) = 1.386348105265697723853732153017686670695581836109569165990080192653647019078... (calculated using Baillie's irwinSums.m, see Links). - Amiram Eldar, Feb 14 2022

A228915 Next larger integer with same digital sum (that is, sum of digits in base 10) as n.

Original entry on oeis.org

10, 11, 12, 13, 14, 15, 16, 17, 18, 100, 20, 21, 22, 23, 24, 25, 26, 27, 28, 101, 30, 31, 32, 33, 34, 35, 36, 37, 38, 102, 40, 41, 42, 43, 44, 45, 46, 47, 48, 103, 50, 51, 52, 53, 54, 55, 56, 57, 58, 104, 60, 61, 62, 63, 64, 65, 66, 67, 68, 105, 70, 71, 72
Offset: 1

Views

Author

Paul Tek, Sep 08 2013

Keywords

Comments

This is a variant of A057168 for the base 10.
All integers except those in A051885 appear in this sequence.
n+9 <= a(n) <= 10*n, for any n > 0.
a(n)-n is a multiple of 9, for any n > 0.

Examples

			To compute a(n):
(1) Choose the rightmost digit D of n strictly less than 9 and with at least one nonzero digit after it (note that D may be a leading zero),
(2) Increment D,
(3) Replace the digits after D by A051885((sum of the digits after D) - 1), left padded with zeros.
For n = 2930:
(1) We choose the 4th digit,
(2) We increment the 4th digit,
(3) We replace the last 3 digits with "029" (= A051885((9+3+0)-1) left padded with zeros to 3 digits).
Hence, a(2930) = 3029.
		

Crossrefs

Programs

  • Mathematica
    nli[n_]:=Module[{k=n+1,s=Total[IntegerDigits[n]]},While[Total[ IntegerDigits[ k]] !=s, k++]; k]; Array[nli,70] (* Harvey P. Dale, Sep 27 2016 *)
  • PARI
    See Link section.
    
  • PARI
    A228915(n,p=1,d,r)={while(8<(d=n%10) || !r, n\=10; r+=d; p*=10); n*p+p+A051885(r-1)} \\ (Based on the above program.) - M. F. Hasler, Mar 15 2022
    
  • Python
    def A228915(n):
        p = r = 0
        while True:
            d = n % 10
            if d < 9 and r: return (n+1)*10**p+A051885(r-1)
            n //= 10; r += d; p += 1
    # (Based on Tek's PARI program.) - M. F. Hasler, Mar 15 2022
Showing 1-10 of 30 results. Next