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.

A057716 The nonpowers of 2.

Original entry on oeis.org

0, 3, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74
Offset: 0

Views

Author

John Lindgren (john.lindgren(AT)Eng.Sun.COM), Oct 24 2000

Keywords

Comments

a(n) is the length signature of a string plus its length.
The positive members of this sequence are exactly the numbers that can be expressed as the sum of two or more consecutive positive integers (cf. A138591). - David Wasserman, Jan 24 2002
Starting at 3, these are the positions of the data bits in the single-error-correcting Hamming code.
Except for the offset 0, sequence corresponds to numbers with at least an odd divisor > 1 (For largest odd divisor see A000265). - Lekraj Beedassy, Apr 12 2005
These are exactly the numbers n with the property that, given the n(n-1)/2 sums of pairs, the original numbers can be recovered uniquely. [Nick Reingold, see Winkler reference.]
Subsequence of A158581; A000120(a(n)) > 1. - Reinhard Zumkeller, Apr 16 2009
Range of A140977. - Reinhard Zumkeller, Aug 15 2010
A209229(a(n)) = 0. - Reinhard Zumkeller, Mar 07 2012
A001227(a(n)) > 1. - Reinhard Zumkeller, May 01 2012
Numbers that can be expressed as the sum of at least two consecutive integers; numbers that can be expressed as the difference of two nonconsecutive triangular numbers. - Charles R Greathouse IV, Jul 27 2012
Except for the 1st term 0, these are the integers k such that 2*(2*k-1) divides binomial(2*k-1,k). See Ihringer & Kupavskii. - Michel Marcus, Oct 02 2017

References

  • Martin Davis, "Algorithms, Equations, and Logic", pp. 4-15 of S. Barry Cooper and Andrew Hodges, Eds., "The Once and Future Turing: Computing the World", Cambridge 2016.
  • Alfred S. Posamentier, Math Charmers, Tantalizing Tidbits for the Mind, Prometheus Books, NY, 2003, pages 67-69.
  • P. Winkler, Mathematical Mind-Benders, Peters, Wellesley, MA, 2007; see p. 27.

Crossrefs

Complement of A000079. Cf. A057717, A001227, A103586, A138591, A138592.
See A074894 for more about the question of when the sums of n numbers taken k at a time determine the numbers.

Programs

  • Haskell
    a057716 n = a057716_list !! n
    a057716_list = filter ((== 0) . a209229) [0..]
    -- Reinhard Zumkeller, Mar 07 2012
    
  • Maple
    select(t -> t/2^padic:-ordp(t,2) <> 1, [$0..100]); # Robert Israel, May 05 2015
  • Mathematica
    Module[{nn = 100,maxpwr},maxpwr = Floor[Log[2, nn]]; Complement[Range[0, nn], 2^Range[0, maxpwr]]]  (* Harvey P. Dale, May 24 2012 *)
    Complement[Range[0, 99], 2^Range[0, 7]] (* Alonso del Arte, May 05 2015 *)
  • PARI
    print1(0);for(n=1,5,for(m=2^n+1,2^(n+1)-1,print1(", "m))) \\ Charles R Greathouse IV, Mar 07 2012
    
  • Python
    def A057716(n): return n + (n + n.bit_length()).bit_length() # Matthew Andres Moreno, Jun 16 2024
    
  • Python
    from itertools import count, islice
    def agen(): # generator of terms
        yield 0
        yield from (j for i in count(0) for j in range(2**i+1, 2**(i+1)))
    print(list(islice(agen(), 70))) # Michael S. Branicky, Oct 11 2024

Formula

a(n) = n + [log_2(n + [log_2(n)])] gives this sequence with the exception of a(1) = 1. - David W. Wilson, Mar 29 2005
Find k such that 2^k - (k + 1) <= n < 2^(k+1) - (k + 2), then a(n) = n + k + 1.
Numbers n = 2a(k) - 1, k > 0 are such that Sum_{k=0..n} B_k*M(n-k)*binomial(n, k) = 0 where B_k is the k-th Bernoulli number and M_k the k-th Motzkin number. - Benoit Cloitre, Oct 19 2005
From Robert Israel, May 05 2015: (Start)
G.f.: (1-x)^(-2)*Sum(m>=0, x^(2^m-m)*(2^m*x-2^m*x^2+x) + x^(2^(m+1)-m)*(2^(m+1)*x-2^(m+1)-x)).
a(i-m) = i for 2^m < i < 2^(m+1).
a(n) = A103586(n) + n for n >= 1. (End)

Extensions

Better description from Ahmed Fares (ahmedfares(AT)my-deja.com), Apr 29 2001

A030130 Binary expansion contains a single 0.

Original entry on oeis.org

0, 2, 5, 6, 11, 13, 14, 23, 27, 29, 30, 47, 55, 59, 61, 62, 95, 111, 119, 123, 125, 126, 191, 223, 239, 247, 251, 253, 254, 383, 447, 479, 495, 503, 507, 509, 510, 767, 895, 959, 991, 1007, 1015, 1019, 1021, 1022, 1535, 1791, 1919, 1983, 2015, 2031, 2039
Offset: 1

Views

Author

Toby Donaldson (tjdonald(AT)uwaterloo.ca)

Keywords

Comments

From Reinhard Zumkeller, Aug 29 2009: (Start)
A023416(a(n)) = 1;
apart from the initial term the sequence can be seen as a triangle read by rows, see A164874;
A055010 and A086224 are subsequences, see also A000918 and A036563. (End)
Zero and numbers of form 2^m-2^k-1, 2 <= m, 0 <= k <= m-2. - Zak Seidov, Aug 06 2010

Examples

			23 is OK because it is '10111' in base 2.
		

Crossrefs

Programs

  • C
    long int element (long int i) { return (pow(2,g(i))-1-pow(2,(pow(2*g(i)-1,2)-1-8*i)/8));} long int g(long int m) {if (m==0) return(1); return ((sqrt(8*m-7)+3)/2);}
    
  • Haskell
    a030130 n = a030130_list !! (n-1)
    a030130_list = filter ((== 1) . a023416) [0..]
    -- Reinhard Zumkeller, Mar 31 2015, Dec 07 2012
    
  • Magma
    [0] cat [k:k in [0..2050]| Multiplicity(Intseq(k,2),0) eq 1]; // Marius A. Burtea, Feb 06 2020
    
  • Mathematica
    Sort[Flatten[{{0}, Table[2^n - 2^m - 1, {n, 2, 50}, {m, 0, n - 2}]}]] (* Zak Seidov, Aug 06 2010 *)
    Select[Range[0,2100],DigitCount[#,2,0]==1&] (* Harvey P. Dale, Dec 19 2021 *)
  • PARI
    print1("0, ");for(k=1,2039,my(v=digits(k,2));if(vecsum(v)==#v-1,print1(k,", "))) \\ Hugo Pfoertner, Feb 06 2020
    
  • Python
    from math import isqrt, comb
    def A030130(n): return (1<<(a:=(isqrt(n-1<<3)+1>>1)+1))-(1<Chai Wah Wu, Dec 19 2024

Formula

a(n) = 2^(g(n))-1-2^(((2*g(n)-1)^2-1-8*n)/8) with g(n)=int((sqrt(8*n-7)+3)/2) for all n>0 and g(0)=1. - Ulrich Schimke (ulrschimke(AT)aol.com)
a(n+1) = A140977(a(n)) for any n > 1. - Rémy Sigrist, Feb 06 2020
Sum_{n>=2} 1/a(n) = A160502. - Amiram Eldar, Oct 06 2020
a(n) = (A190620(n-1)-1)/2. - Chai Wah Wu, Dec 19 2024

Extensions

More terms from Erich Friedman
Offset fixed by Reinhard Zumkeller, Aug 24 2009

A145257 a(n) is the smallest integer > n that is non-coprime to n and has the same number of 0's in its binary representation as n has.

Original entry on oeis.org

6, 15, 10, 30, 14, 63, 18, 12, 12, 55, 21, 247, 30, 63, 34, 85, 20, 57, 24, 28, 26, 253, 38, 45, 28, 30, 46, 1015, 55, 1023, 66, 36, 36, 42, 40, 185, 42, 45, 48, 205, 44, 215, 50, 51, 54, 14335, 69, 56, 52, 54, 56, 159, 57, 95, 77, 60, 60, 767, 87, 4087, 126, 255, 130, 80
Offset: 2

Views

Author

Leroy Quet, Oct 05 2008

Keywords

Crossrefs

Cf. A023416 (number of 0's in binary expansion of n).

Programs

  • Magma
    a:=[]; for n in [2..70] do k:=n+1; while Gcd(n,k) eq 1 or  Multiplicity(Intseq(n,2),0) ne  Multiplicity(Intseq(k,2),0) do k:=k+1; end while; Append(~a,k); end for; a; // Marius A. Burtea, Feb 06 2020
  • Mathematica
    a[n_] := Block[{},i = n + 1; While[GCD[i, n] == 1 || Not[DigitCount[n, 2, 0] == DigitCount[i, 2, 0]], i++ ]; i]; Table[a[n], {n, 2, 100}] (* Stefan Steinerberger, Oct 17 2008 *)
    sncp[n_]:=Module[{k=n+1},While[CoprimeQ[k,n]||DigitCount[k,2,0]!=DigitCount[ n,2,0],k++];k]; Array[sncp,70,2] (* Harvey P. Dale, Aug 11 2024 *)
  • PARI
    \\ See Links section.
    
  • PARI
    a(n) = {my(m = n+1, nb = #binary(n) - hammingweight(n)); while (!((gcd(m, n) > 1) && (nb == #binary(m) - hammingweight(m))), m++); m;} \\ Michel Marcus, Feb 06 2020
    

Extensions

More terms from Stefan Steinerberger, Oct 17 2008
a(58)-a(64) from Ray Chandler, Jun 20 2009

A112411 a(n) = smallest positive integer, not occurring earlier in the sequence and not equal to n, that has the same number of (non-leading) 0's in its binary representation as n.

Original entry on oeis.org

3, 5, 1, 9, 2, 11, 15, 17, 4, 12, 6, 10, 14, 13, 7, 33, 8, 20, 21, 18, 19, 25, 27, 35, 22, 28, 23, 26, 30, 29, 63, 65, 16, 36, 24, 34, 38, 37, 43, 48, 42, 41, 39, 49, 46, 45, 55, 40, 44, 52, 53, 50, 51, 57, 47, 71, 54, 60, 61, 58, 59, 95, 31, 129, 32, 68, 69, 66, 67, 73, 56, 80
Offset: 1

Views

Author

Leroy Quet, Dec 08 2005

Keywords

Comments

Sequence is a permutation of the positive integers. It is its own inverse permutation.

Examples

			Among positive integers not among the first 8 terms of the sequence, 4 (100 in binary) is the smallest positive integer which has the same number of non-leading zeros in its binary representation as 9 (1001 in binary). So a(9) = 4.
		

Crossrefs

Programs

  • Python
    from itertools import islice
    def val(n): return (~n & n-1).bit_length() # From Chai Wah Wu in A007814
    def next0(n):
        z = val(n)
        f = (n|(2**z)-1) + 1
        w = val(f)
        if f != 2**w: z+=1
        return(f|(2**(w-z)-1))
    def a_gen():
        B,n = [],1
        while True:
            f = 0
            for i in B:
                if i[0] == n:
                    f+=1; n+=1; yield(i[1]); B.remove(i); break
            if f < 1:
                B.append((next0(n),n)); yield(next0(n)); n+=1
    A112411_list = list(islice(a_gen(), 100)) # John Tyler Rascoe, Mar 20 2024

Extensions

More terms from R. J. Mathar, Feb 08 2008
Showing 1-4 of 4 results.