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-9 of 9 results.

A280799 a(n) = A049502(phi(n)).

Original entry on oeis.org

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

Views

Author

Indranil Ghosh, Jan 08 2017

Keywords

Comments

a(n) = Major index (2nd definition) of the total numbers <=n and prime to n i.e., phi(n).

Examples

			For n = 11, phi(n) = 10 and major index (2nd definition) of 10 = 2. So a(n) = 2.
		

Crossrefs

Formula

a(n) = A049502(A000010(n)).

A279519 a(n) = A049502(A003418(n)).

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 9, 11, 14, 14, 23, 23, 42, 42, 42, 46, 79, 79, 48, 48, 48, 48, 95, 95, 125, 125, 180, 180, 182, 182, 307, 320, 320, 320, 320, 320, 365, 365, 365, 365, 390, 390, 451, 451, 451, 451, 360, 360, 564, 564, 564, 564, 582, 582, 582, 582, 582, 582, 745, 745, 804, 804, 804, 822, 822, 822, 866
Offset: 0

Views

Author

Indranil Ghosh, Dec 14 2016

Keywords

Examples

			For n=10, the LCM of all the numbers from 1 to 10 is 2520 = 100111011000_2, whose major index (2nd definition) is 14, so a(10)=14.
		

Crossrefs

Programs

  • Mathematica
    Map[Total@ SequencePosition[Reverse@ #, {1, 0}][[All, 1]] &@ IntegerDigits[#, 2] &, {1}~Join~Table[LCM @@ Range@ n, {n, 67}]] (* Michael De Vlieger, Dec 16 2016, Version 10.1 *)

A280062 a(n) = A049502(A000142(n)).

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 13, 16, 22, 38, 47, 73, 60, 127, 160, 166, 194, 249, 348, 345, 359, 497, 532, 682, 709, 727, 1000, 887, 1312, 1155, 1297, 1934, 2069, 1722, 1796, 2148, 2337, 1839, 2595, 2774, 2440, 3314, 3450, 3253, 3379, 3786, 4466, 4366, 4795, 5189, 5598
Offset: 0

Views

Author

Indranil Ghosh, Jan 04 2017

Keywords

Comments

a(n) is the major index (2nd definition) of n!.

Examples

			for n=15, A000142(n) = 1307674368000 and A049502(1307674368000) = 166. So a(n) = 166.
		

Crossrefs

Programs

  • Python
    import math
    def m(N):
        x=bin(int(N))[2:][::-1]
        s=0
        for i in range(1,len(x)):
            if x[i-1]=="1" and x[i]=="0":
                s+=i
        return s
    a=lambda n: m(math.factorial(n))

A280815 a(n) = A049502(cototient(n)).

Original entry on oeis.org

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

Views

Author

Indranil Ghosh, Jan 08 2017

Keywords

Comments

a(n) = major index (2nd definition) of cototient(n), where cototient(n) = n - phi(n).

Examples

			For n = 30, cototient(n) = 22 and major index (2nd definition) of 22 is 3. So, a(n) = 3.
		

Crossrefs

Formula

a(n) = A049502(A051953(n)).

A280843 a(n) = A049502(sigma(n)).

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 2, 3, 3, 6, 0, 3, 0, 0, 0, 6, 4, 0, 0, 4, 0, 0, 0, 3, 0, 7, 3, 0, 0, 7, 6, 0, 4, 8, 4, 4, 0, 0, 1, 6, 4, 2, 3, 0, 4, 0, 5, 7, 0, 10, 0, 0, 4, 0, 8, 5, 3, 0, 0, 5, 4, 2, 6, 2, 0, 4, 0, 10, 5, 8, 1, 0, 8, 0, 4, 3, 0, 9, 7, 6, 0, 10, 0, 5, 0, 0, 2, 12, 5, 6, 3, 5, 4, 7, 0, 8, 4, 5, 4
Offset: 1

Views

Author

Indranil Ghosh, Jan 08 2017

Keywords

Comments

a(n) = major index (2nd definition) of the sum of the divisors of n, i.e., sigma(n).

Examples

			For n = 10, sigma(10) = 18 and major index (2nd definition) of 18 is 2. So, a(10) = 2.
		

Crossrefs

Formula

a(n) = A049502(A000203(n)).

A023758 Numbers of the form 2^i - 2^j with i >= j.

Original entry on oeis.org

0, 1, 2, 3, 4, 6, 7, 8, 12, 14, 15, 16, 24, 28, 30, 31, 32, 48, 56, 60, 62, 63, 64, 96, 112, 120, 124, 126, 127, 128, 192, 224, 240, 248, 252, 254, 255, 256, 384, 448, 480, 496, 504, 508, 510, 511, 512, 768, 896, 960, 992, 1008, 1016, 1020, 1022, 1023
Offset: 1

Views

Author

Keywords

Comments

Numbers whose digits in base 2 are in nonincreasing order.
Might be called "nialpdromes".
Subset of A077436. Proof: Since a(n) is of the form (2^i-1)*2^j, i,j >= 0, a(n)^2 = (2^(2i) - 2^(i+1))*2^(2j) + 2^(2j) where the first sum term has i-1 one bits and its 2j-th bit is zero, while the second sum term switches the 2j-th bit to one, giving i one bits, as in a(n). - Ralf Stephan, Mar 08 2004
Numbers whose binary representation contains no "01". - Benoit Cloitre, May 23 2004
Every polynomial with coefficients equal to 1 for the leading terms and 0 after that, evaluated at 2. For instance a(13) = x^4 + x^3 + x^2 at 2, a(14) = x^4 + x^3 + x^2 + x at 2. - Ben Paul Thurston, Jan 11 2008
From Gary W. Adamson, Jul 18 2008: (Start)
As a triangle by rows starting:
1;
2, 3;
4, 6, 7;
8, 12, 14, 15;
16, 24, 28, 30, 31;
...,
equals A000012 * A130123 * A000012, where A130123 = (1, 0,2; 0,0,4; 0,0,0,8; ...). Row sums of this triangle = A000337 starting (1, 5, 17, 49, 129, ...). (End)
First differences are A057728 = 1; 1; 1; 1; 2,1; 1; 4,2,1; 1; 8,4,2,1; 1; ... i.e., decreasing powers of 2, separated by another "1". - M. F. Hasler, May 06 2009
Apart from first term, numbers that are powers of 2 or the sum of some consecutive powers of 2. - Omar E. Pol, Feb 14 2013
From Andres Cicuttin, Apr 29 2016: (Start)
Numbers that can be digitally generated with twisted ring (Johnson) counters. This is, the binary digits of a(n) correspond to those stored in a shift register where the input bit of the first bit storage element is the inverted output of the last storage element. After starting with all 0’s, each new state is obtained by rotating the stored bits but inverting at each state transition the last bit that goes to the first position (see link).
Examples: for a(n) represented by three bits
Binary
a(5)= 4 -> 100 last bit = 0
a(6)= 6 -> 110 first bit = 1 (inverted last bit of previous number)
a(7)= 7 -> 111
and for a(n) represented by four bits
Binary
a(8) = 8 -> 1000
a(9) = 12 -> 1100 last bit = 0
a(10)= 14 -> 1110 first bit = 1 (inverted last bit of previous number)
a(11)= 15 -> 1111
(End)
Powers of 2 represented in bases which are terms of this sequence must always contain at least one digit which is also a power of 2. This is because 2^i mod (2^i - 2^j) = 2^j, which means the last digit always cycles through powers of 2 (or if i=j+1 then the first digit is a power of 2 and the rest are trailing zeros). The only known non-member of this sequence with this property is 5. - Ely Golden, Sep 05 2017
Numbers k such that k = 2^(1 + A000523(k)) - 2^A007814(k). - Daniel Starodubtsev, Aug 05 2021
A002260(n) = v(a(n)/2^v(a(n))+1) and A002024(n) = A002260(n) + v(a(n)) where v is the dyadic valuation (i.e., A007814). - Lorenzo Sauras Altuzarra, Feb 01 2023

Examples

			a(22) = 64 = 32 + 32 = 2^5 + a(16) = 2^A003056(20) + a(22-5-1).
a(23) = 96 = 64 + 32 = 2^6 + a(16) = 2^A003056(21) + a(23-6-1).
a(24) = 112 = 64 + 48 = 2^6 + a(17) = 2^A003056(22) + a(24-6-1).
		

Crossrefs

A000337(r) = sum of row T(r, c) with 0 <= c < r. See also A002024, A003056, A140129, A140130, A221975.
Cf. A007088, A130123, A101082 (complement), A340375 (characteristic function).
This is the base-2 version of A064222. First differences are A057728.
Subsequence of A077436, of A129523, of A277704, and of A333762.
Subsequences: A043569 (nonzero even terms, or equally, nonzero terms doubled), A175332, A272615, A335431, A000396 (its even terms only), A324200.
Positions of zeros in A049502, A265397, A277899, A284264.
Positions of ones in A283983, A283989.
Positions of nonzero terms in A341509 (apart from the initial zero).
Positions of squarefree terms in A260443.
Fixed points of A264977, A277711, A283165, A334666.
Distinct terms in A340632.
Cf. also A309758, A309759, A309761 (for analogous sequences).

Programs

  • Haskell
    import Data.Set (singleton, deleteFindMin, insert)
    a023758 n = a023758_list !! (n-1)
    a023758_list = 0 : f (singleton 1) where
    f s = x : f (if even x then insert z s' else insert z $ insert (z+1) s')
    where z = 2*x; (x, s') = deleteFindMin s
    -- Reinhard Zumkeller, Sep 24 2014, Dec 19 2012
    
  • Maple
    a:=proc(n) local n2,d: n2:=convert(n,base,2): d:={seq(n2[j]-n2[j-1],j=2..nops(n2))}: if n=0 then 0 elif n=1 then 1 elif d={0,1} or d={0} or d={1} then n else fi end: seq(a(n),n=0..2100); # Emeric Deutsch, Apr 22 2006
  • Mathematica
    Union[Flatten[Table[2^i - 2^j, {i, 0, 100}, {j, 0, i}]]] (* T. D. Noe, Mar 15 2011 *)
    Select[Range[0, 2^10], NoneTrue[Differences@ IntegerDigits[#, 2], # > 0 &] &] (* Michael De Vlieger, Sep 05 2017 *)
  • PARI
    for(n=0,2500,if(prod(k=1,length(binary(n))-1,component(binary(n),k)+1-component(binary(n),k+1))>0,print1(n,",")))
    
  • PARI
    A023758(n)= my(r=round(sqrt(2*n--))); (1<<(n-r*(r-1)/2)-1)<<(r*(r+1)/2-n)
    /* or, to illustrate the "decreasing digit" property and analogy to A064222: */
    A023758(n,show=0)={ my(a=0); while(n--, show & print1(a","); a=vecsort(binary(a+1)); a*=vector(#a,j,2^(j-1))~); a} \\ M. F. Hasler, May 06 2009
    
  • PARI
    is(n)=if(n<5,1,n>>=valuation(n,2);n++;n>>valuation(n,2)==1) \\ Charles R Greathouse IV, Jan 04 2016
    
  • PARI
    list(lim)=my(v=List([0]),t); for(i=1,logint(lim\1+1,2), t=2^i-1; while(t<=lim, listput(v,t); t*=2)); Set(v) \\ Charles R Greathouse IV, May 03 2016
    
  • Python
    def a_next(a_n): return (a_n | (a_n >> 1)) + (a_n & 1)
    a_n = 1; a = [0]
    for i in range(55): a.append(a_n); a_n = a_next(a_n) # Falk Hüffner, Feb 19 2022
    
  • Python
    from math import isqrt
    def A023758(n): return (1<<(m:=isqrt(n-1<<3)+1>>1))-(1<<(m*(m+1)-(n-1<<1)>>1)) # Chai Wah Wu, Feb 23 2025

Formula

a(n) = 2^s(n) - 2^((s(n)^2 + s(n) - 2n)/2) where s(n) = ceiling((-1 + sqrt(1+8n))/2). - Sam Alexander, Jan 08 2005
a(n) = 2^k + a(n-k-1) for 1 < n and k = A003056(n-2). The rows of T(r, c) = 2^r-2^c for 0 <= c < r read from right to left produce this sequence: 1; 2, 3; 4, 6, 7; 8, 12, 14, 15; ... - Frank Ellermann, Dec 06 2001
For n > 0, a(n) mod 2 = A010054(n). - Benoit Cloitre, May 23 2004
A140130(a(n)) = 1 and for n > 1: A140129(a(n)) = A002262(n-2). - Reinhard Zumkeller, May 14 2008
a(n+1) = (2^(n - r(r-1)/2) - 1) 2^(r(r+1)/2 - n), where r=round(sqrt(2n)). - M. F. Hasler, May 06 2009
Start with A000225. If k is in the sequence, then so is 2k. - Ralf Stephan, Aug 16 2013
G.f.: (x^2/((2-x)*(1-x)))*(1 + Sum_{k>=0} x^((k^2+k)/2)*(1 + x*(2^k-1))). The sum is related to Jacobi theta functions. - Robert Israel, Feb 24 2015
A049502(a(n)) = 0. - Reinhard Zumkeller, Jun 17 2015
a(n) = a(n-1) + a(n-d)/a(d*(d+1)/2 + 2) if n > 1, d > 0, where d = A002262(n-2). - Yuchun Ji, May 11 2020
A277699(a(n)) = a(n)^2, A306441(a(n)) = a(n+1). - Antti Karttunen, Feb 15 2021 (the latter identity from A306441)
Sum_{n>=2} 1/a(n) = A211705. - Amiram Eldar, Feb 20 2022

Extensions

Definition changed by N. J. A. Sloane, Jan 05 2008

A101082 Numbers n such that binary representation contains bit strings "10" and "01" (possibly overlapping).

Original entry on oeis.org

5, 9, 10, 11, 13, 17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 29, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 49, 50, 51, 52, 53, 54, 55, 57, 58, 59, 61, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92
Offset: 1

Views

Author

Rick L. Shepherd, Nov 29 2004

Keywords

Comments

Subsequence of A062289; set difference A062289 minus A043569.
Complement of A023758. Also numbers not the sum of consecutive powers of 2. - Omar E. Pol, Mar 04 2013
Equivalently, numbers not the difference of two powers of two. - Charles R Greathouse IV, Mar 07 2013
The terms >=9 are bases in which a power of 2 exists, which does not contain a digit that is a power of 2. In base 10, 2^16 = 65536 is such a number, as it does not contain any one-digit power of 2, which in base 10 are 1, 2, 4 and 8. - Patrick Wienhöft, Jul 28 2016

Examples

			29 = 11101_2 is a term, "10" and "01" are contained (here overlapping).
		

Crossrefs

Complement: A023758.

Programs

  • Haskell
    a101082 n = a101082_list !! (n-1)
    a101082_list = filter ((> 0) . a049502) [0..]
    -- Reinhard Zumkeller, Jun 17 2015
    
  • Mathematica
    Select[Range@ 120, Function[d, Times @@ Total@ Map[Map[Function[k, Boole@ MatchQ[#, k]], {{1, 0}, {0, 1}}] &, Partition[d, 2, 1]] > 0]@ IntegerDigits[#, 2] &] (* Michael De Vlieger, Dec 23 2016 *)
    Select[Range[100],With[{c=IntegerDigits[#,2]},SequenceCount[c,{1,0}]>0&&SequenceCount[c,{0,1}]>0]&] (* Harvey P. Dale, Jun 08 2025 *)
  • PARI
    is(n)=n>>=valuation(n,2);n+1!=1<Charles R Greathouse IV, Mar 07 2013
    
  • Python
    def A101082(n):
        def f(x): return n+((k:=x.bit_length())*(k-1)>>1)+sum(1 for i in range(k) if (1<Chai Wah Wu, Feb 23 2025

Formula

a(n) ~ n. In particular a(n) = n + (log_2 n)^2/2 + O(log n). - Charles R Greathouse IV, Mar 07 2013
A049502(a(n)) > 0. - Reinhard Zumkeller, Jun 17 2015

A049501 Major index of n, first definition.

Original entry on oeis.org

0, 0, 1, 0, 1, 1, 2, 0, 1, 1, 4, 1, 2, 2, 3, 0, 1, 1, 5, 1, 4, 4, 5, 1, 2, 2, 6, 2, 3, 3, 4, 0, 1, 1, 6, 1, 5, 5, 6, 1, 4, 4, 9, 4, 5, 5, 6, 1, 2, 2, 7, 2, 6, 6, 7, 2, 3, 3, 8, 3, 4, 4, 5, 0, 1, 1, 7, 1, 6, 6, 7, 1, 5, 5, 11, 5, 6, 6, 7, 1, 4, 4, 10, 4, 9, 9, 10, 4, 5, 5, 11, 5, 6, 6, 7, 1, 2, 2, 8, 2, 7, 7, 8
Offset: 0

Views

Author

Keywords

Examples

			50 = 110010 has 1's followed by 0's in positions 2 and 5 (reading from the left), so a(50)=7. At the beginning of the sequence we have 0->0, 1->0, 10->1, 11->0, 100->1, 101->1, 110->2, 111->0, 1000->1, 1001->1, 1010->1+3=4, ...
		

References

  • D. M. Bressoud, Proofs and Confirmations, Camb. Univ. Press, 1999; cf. p. 89.

Crossrefs

Cf. A049502.

Programs

  • Mathematica
    a[n_] := Total[ Flatten[ Position[ IntegerDigits[n, 2] //. {b___, 1, 0, c___} -> {b, 2, 3, c}, 2]]]; Table[a[n], {n, 0, 102}] (* Jean-François Alcover, Dec 20 2011 *)
    Table[Total[Flatten[Position[Partition[IntegerDigits[n,2],2,1],{1,0}]]],{n,0,110}] (* Harvey P. Dale, Nov 04 2012 *)
    Table[Total[SequencePosition[IntegerDigits[n,2],{1,0}][[;;,1]]],{n,0,110}] (* Harvey P. Dale, Feb 19 2023 *)

Formula

Write n in binary; sum the positions where there is a '1' followed immediately to the right by a '0', counting the leftmost digit as position '1'.

Extensions

More terms from Erich Friedman, Feb 19 2000

A281497 Write n in binary reflected Gray code and sum the positions where there is a '1' followed immediately to the left by a '0', counting the rightmost digit as position 1.

Original entry on oeis.org

0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 2, 2, 1, 0, 0, 1, 2, 2, 0, 0, 1, 0, 3, 4, 3, 3, 2, 2, 1, 0, 0, 1, 2, 2, 3, 3, 4, 3, 0, 1, 0, 0, 2, 2, 1, 0, 4, 5, 6, 6, 4, 4, 5, 4, 3, 4, 3, 3, 2, 2, 1, 0, 0, 1, 2, 2, 3, 3, 4, 3, 4, 5, 4, 4, 6, 6, 5, 4, 0, 1, 2, 2, 0, 0, 1, 0, 3, 4, 3, 3, 2, 2, 1, 0, 5, 6, 7, 7, 8, 8, 9, 8, 5, 6, 5, 5, 7, 7, 6
Offset: 1

Views

Author

Indranil Ghosh, Jan 23 2017

Keywords

Examples

			For n = 12, the binary reflected Gray code for 12 is '1010'. In '1010', the position of '1' followed immediately to the left by a '0' counting from right is 2. So, a(12) = 2.
		

Crossrefs

Programs

  • Mathematica
    Table[If[Length@ # == 0, 0, Total[#[[All, 1]]]] &@ SequencePosition[ Reverse@ IntegerDigits[#, 2] &@ BitXor[n, Floor[n/2]], {1, 0}], {n, 120}] (* Michael De Vlieger, Jan 23 2017, Version 10.1, after Robert G. Wilson v at A003188 *)
  • Python
    def G(n):
        return bin(n^(n/2))[2:]
    def a(n):
        x=G(n)[::-1]
        s=0
        for i in range(1,len(x)):
            if x[i-1]=="1" and x[i]=="0":
                s+=i
        return s

Formula

a(n) = A049502(A003188(n)).
Showing 1-9 of 9 results.