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.

A280726 a(n) = A049501(phi(n)).

Original entry on oeis.org

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

Views

Author

Indranil Ghosh, Jan 07 2017

Keywords

Comments

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

Examples

			For n = 10, phi(n) = 4 and major index (1st definition) of 4 = 1. So a(n) = 1.
		

Crossrefs

Formula

a(n) = A049501(A000010(n)).

A280800 a(n) = A049501(cototient(n)).

Original entry on oeis.org

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

Views

Author

Indranil Ghosh, Jan 08 2017

Keywords

Comments

a(n) = major index (1st definition) of cototient(n), where cototient(n) = n - phi(n).

Examples

			For n = 10, A051953(n) = 6 and major index (1st definition) of 6 is 2. So, a(10) = 2.
		

Crossrefs

Formula

a(n) = A049501(A051953(n)).

A280306 a(n) = A049501(A003418(n)).

Original entry on oeis.org

0, 0, 1, 2, 2, 4, 4, 13, 13, 16, 16, 28, 28, 46, 46, 46, 46, 77, 77, 48, 48, 48, 48, 117, 117, 141, 141, 134, 134, 213, 213, 326, 326, 326, 326, 326, 326, 352, 352, 352, 352, 389, 389, 413, 413, 413, 413, 508, 508
Offset: 0

Views

Author

Indranil Ghosh, Dec 31 2016

Keywords

Comments

This calculates the major index (1st definition) of the LCM of all the numbers from 1 to n.

Examples

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

Crossrefs

A280531 a(n) = A049501(A000142(n)).

Original entry on oeis.org

0, 0, 1, 2, 2, 4, 11, 16, 16, 25, 30, 64, 39, 83, 111, 139, 139, 165, 205, 242, 283, 320, 336, 474, 440, 395, 637, 655, 886, 842, 1019, 1159, 1159, 1153, 1327, 1366, 1328, 1243, 1487, 1756, 1623, 2362, 2394, 2274, 2487, 2642, 2907, 2843, 3211, 3049, 3736
Offset: 0

Views

Author

Indranil Ghosh, Jan 04 2017

Keywords

Comments

a(n) is the major index (1st definition) of n!.

Examples

			For n=4, A000142(n) = 24 and A049501(24) = 2. So a(n) = 2.
		

Crossrefs

Cf. A280062 (Major index (2nd definition) of n!).

Programs

  • Python
    import math
    def M(n):
        x=bin(int(n))[2:]
        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))

A280817 a(n) = A049501(sigma(n)).

Original entry on oeis.org

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

Views

Author

Indranil Ghosh, Jan 08 2017

Keywords

Comments

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

Examples

			For n = 10, sigma(n) = 18 and major index (1st definition) of 18 is 5. So, a(10) = 5.
		

Crossrefs

Programs

Formula

a(n) = A049501(A000203(n)).

A049502 Major index of n, 2nd definition.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

a(A023758(n)) = 0; a(A101082(n)) > 0. - Reinhard Zumkeller, Jun 17 2015

Examples

			83 = 1010011 has 1's followed by 0's in positions 2 and 5 (reading from the right), so a(83)=7.
		

References

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

Crossrefs

Programs

  • Haskell
    a049502 = f 0 1 where
       f m i x = if x <= 4
                    then m else f (if mod x 4 == 1
                                      then m + i else m) (i + 1) $ div x 2
    -- Reinhard Zumkeller, Jun 17 2015
    
  • Maple
    A049502 := proc(n)
        local a,ndgs,p ;
        a := 0 ;
        ndgs := convert(n,base,2) ;
        for p from 1 to nops(ndgs)-1 do
            if op(p,ndgs)- op(p+1,ndgs) = 1 then
                a := a+p ;
            end if;
        end do:
        a ;
    end proc: # R. J. Mathar, Oct 17 2012
  • Mathematica
    Table[Total[Flatten[Position[Partition[Reverse[IntegerDigits[n,2]],2,1],?(#=={1,0}&)]]],{n,0,110}] (* _Harvey P. Dale, Oct 05 2013 *)
    Table[Total[SequencePosition[Reverse[IntegerDigits[n,2]],{1,0}][[All,1]]],{n,0,120}] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Nov 26 2020 *)
  • PARI
    a(n)=if(n<5, return(0)); sum(i=0,exponent(n)-1, (bittest(n,i) && !bittest(n,i+1))*(i+1)) \\ Charles R Greathouse IV, Jan 30 2023
  • Python
    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
    for i in range(101):
        print(str(i)+" "+str(m(i))) # Indranil Ghosh, Dec 22 2016
    

Formula

Write n in binary; add positions where there are 1's followed by 0's, counting from right.

Extensions

More terms from Erich Friedman, Feb 19 2000

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

Original entry on oeis.org

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

Views

Author

Indranil Ghosh, Jan 21 2017

Keywords

Examples

			For n = 11, the binary reflected Gray code for 11 is '1110'. In '1110', the position of '1' followed immediately to the right by '0' counting from left is 3. So, a(11) = 3.
For n = 12, the binary reflected Gray code for 12 is '1010'. In '1010', the positions of '1' followed immediately to the right by '0' counting from left are 1 and 3. So, a(12) = 1 + 3 = 4.
		

Crossrefs

Programs

  • Python
    def g(n):
        return bin(n^(n//2))[2:]
    def a(n):
        x=g(n)
        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) = A049501(A003188(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)).

A281552 Write n in the Elias gamma code and sum the positions where there is a '1' followed immediately to the right by a '0', counting the leftmost digit as position 1.

Original entry on oeis.org

0, 1, 1, 2, 2, 6, 2, 3, 3, 9, 3, 8, 8, 9, 3, 4, 4, 12, 4, 11, 11, 12, 4, 10, 10, 18, 10, 11, 11, 12, 4, 5, 5, 15, 5, 14, 14, 15, 5, 13, 13, 23, 13, 14, 14, 15, 5, 12, 12, 22, 12, 21, 21, 22, 12, 13, 13, 23, 13, 14, 14, 15, 5, 6, 6, 18, 6, 17, 17, 18, 6, 16, 16, 28, 16, 17, 17, 18, 6
Offset: 1

Views

Author

Indranil Ghosh, Jan 24 2017

Keywords

Examples

			For n = 6 , the Elias gamma code for n is '11010'. In '11010', the positions of '1' followed immediately to the right by '0' counting from left are 2 and 4. So, a(6) = 2 + 4 = 6.
For n = 10, the Elias gamma code for n is '1110010'. In '1110010', the positions of '1' followed immediately to the right by '0' counting from left are 3 and 6. So, a(10) = 3 + 6 = 9.
		

Crossrefs

Programs

  • Python
    def a(n):
        x= A281149(n)
        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) = A049501(A171885(n)) for n > = 1.
Showing 1-9 of 9 results.