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.

User: Indranil Ghosh

Indranil Ghosh's wiki page.

Indranil Ghosh has authored 81 sequences. Here are the ten most recent ones:

A285098 Row sums of irregular triangle A070168.

Original entry on oeis.org

1, 3, 23, 7, 20, 29, 124, 15, 147, 30, 117, 41, 63, 138, 296, 31, 106, 165, 231, 50, 84, 139, 281, 65, 294, 89, 40616, 166, 212, 326, 40486, 63, 377, 140, 258, 201, 259, 269, 986, 90, 40589, 126, 588, 183, 253, 327, 40455, 113, 382, 344, 514, 141, 223, 40670, 41000, 222
Offset: 1

Author

Indranil Ghosh, Apr 17 2017

Keywords

Comments

a(n) is the sum of numbers in trajectory of Terras-modified Collatz problem with first number n.

Examples

			The 5th row of irregular triangle A070168 is [5, 8, 4, 2, 1] whose sum is 20. a(5) = 5 + 8 + 4 + 2 + 1 = 20.
		

Crossrefs

Programs

  • Mathematica
    a[n_]:=If[n<2, 1, If[OddQ[n], (3n + 1)/2, n/2]]; Table[-1 + Plus @@ FixedPointList[a, n], {n, 100}]
  • Python
    def a(n):
        if n==1: return 1
        l=[n]
        while True:
            if n%2==0: n//=2
            else: n = (3*n + 1)//2
            l.append(n)
            if n<2: break
        return sum(l)
    print([a(n) for n in range(1, 101)])

A281553 Write n in binary reflected Gray code, rotate one binary place to the right and convert the code back to decimal.

Original entry on oeis.org

0, 1, 3, 1, 3, 7, 6, 2, 6, 14, 15, 7, 5, 13, 12, 4, 12, 28, 29, 13, 15, 31, 30, 14, 10, 26, 27, 11, 9, 25, 24, 8, 24, 56, 57, 25, 27, 59, 58, 26, 30, 62, 63, 31, 29, 61, 60, 28, 20, 52, 53, 21, 23, 55, 54, 22, 18, 50, 51, 19, 17, 49, 48, 16, 48, 112, 113, 49, 51, 115, 114, 50, 54, 118
Offset: 0

Author

Indranil Ghosh, Jan 24 2017

Keywords

Comments

a(n) = A003188(n), iff the Elias delta code for n contains all 1's without any zeros (see the example section).

Examples

			For n = 5, the binary reflected Gray code for n is '111'. Rotating one binary place to the right , '111' gives back '111' again. 111_2 = 7_10. So, a(5) = 7. (For n = 5, A003188(n) = 7).
For n = 15, the binary reflected Gray code for n is '1000'. Rotating one binary place to the right, '1000' gives '0100'. 100_2 = 4_10. So, a(15) = 4.
		

Crossrefs

Programs

  • Python
    def rotation(n):
        x=bin(n^(n/2))[2:]
        return int(x[-1]+x[:-1],2)

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

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.

A281551 Prime numbers p such that the decimal representation of its Elias gamma code is also a prime.

Original entry on oeis.org

3, 23, 41, 47, 59, 89, 101, 149, 179, 227, 317, 347, 353, 383, 389, 479, 503, 599, 821, 887, 929, 977, 1019, 1109, 1229, 1283, 1319, 1511, 1571, 1619, 1667, 1709, 1733, 1787, 1847, 1889, 1907, 1913, 1931, 2207, 2309, 2333, 2357, 2399, 2417, 2459, 2609, 2753, 2789, 2909, 2963, 2999, 3203, 3257, 3299
Offset: 1

Author

Indranil Ghosh, Jan 24 2017

Keywords

Examples

			59 is in the sequence because the decimal representation of its Elias gamma code is 2011 and both 59 and 2011 are prime numbers.
		

Crossrefs

Cf. A000040, A171885 (decimal representation of Elias gamma code), A281149, A281316.

Programs

  • Python
    import math
    from sympy import isprime
    def unary(n):
        return "1"*(n-1)+"0"
    def elias_gamma(n):
        if n ==1:
            return "1"
        k=int(math.log(n,2))
        fp=unary(1+k)    #fp is the first part
        sp=n-2**(k)      #sp is the second part
        nb=k             #nb is the number of bits used to store sp in binary
        sp=bin(sp)[2:]
        if len(sp)
    				

A281550 Number of 2 X 2 matrices with all elements in 0..n such that the sum of the elements is prime.

Original entry on oeis.org

0, 10, 46, 114, 234, 458, 826, 1370, 2090, 3010, 4174, 5658, 7534, 9930, 12954, 16662, 21074, 26242, 32246, 39182, 47186, 56386, 66874, 78798, 92290, 107434, 124282, 142942, 163550, 186266, 211250, 238626, 268526, 301134, 336610, 375086, 416678, 461454, 509434, 560662, 615182, 673106
Offset: 0

Author

Indranil Ghosh, Jan 23 2017

Keywords

Examples

			For n = 4, a few of the possible matrices are [0,4;2,1], [0,4;3,0], [0,4;3,4], [0,4;4,3], [1,0;0,1], [1,0;0,2], [1,0;0,4], [1,0;1,0], [1,0;1,1], [1,0;1,3], [2,2;3,0], [2,2;3,4], [2,2;4,3], [2,3;0,0], [2,3;0,2], [3,4;3,3], [3,4;4,0], [3,4;4,2], [4,0;0,1], [4,0;0,3], [4,0;1,0], ... There are 234 possibilities.
Here each of the matrices M is defined as M = [a,b;c,d] where a = M[1][1], b = M[1][2], c = M[2][1], d = M[2][2]. So, a(4) = 234.
		

Crossrefs

Programs

  • PARI
    a(n)=my(X=Pol(vector(n+1,i,1))+O('x^(4*n)),Y=X^4,s); forprime(p=2,4*n, s+=polcoeff(Y,p)); s \\ Charles R Greathouse IV, Feb 15 2017
  • Python
    from sympy import isprime
    def t(n):
        s=0
        for a in range(0, n+1):
            for b in range(0, n+1):
                for c in range(0, n+1):
                    for d in range(0, n+1):
                        if isprime(a+b+c+d)==True:
                            s+=1
        return s
    for i in range(0, 201):
        print(str(i)+" "+str(t(i)))
    

Formula

a(n) = Sum_{p prime} Sum_{k=0..4} (-1)^k * binomial(4, k) * binomial(p+3-k*(n+1), 3). - David Radcliffe, Jun 13 2025

A281496 Numbers n such that the decimal representation of the Elias delta code of n is a palindromic prime.

Original entry on oeis.org

133, 18279, 19279, 24279, 25279, 30379, 263213, 323213, 333213, 374213, 384213, 404213, 33907213, 35117213, 37037213, 37237213, 37537213, 39757213, 41377213, 42088213, 42188213, 43498213, 43598213, 45518213, 46328213, 47138213, 48958213, 49258213, 49658213, 51478213, 51989213, 52289213, 54109213, 55019213, 58049213
Offset: 1

Author

Indranil Ghosh, Jan 23 2017

Keywords

Comments

Numbers n such that A003188(n) is in A002385.
a(n) is always odd.

Examples

			133 is in the sequence because the decimal representation of its Elias delta code is 14341 which is both prime and palindromic.
18279 is in the sequence because the decimal representation of its Elias delta code is 1951591 and 1951591 is both prime and palindromic.
		

Crossrefs

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

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)).

A281499 Write n in binary reflected Gray code, interchange the 1's and 0's, reverse the code and convert it back to decimal.

Original entry on oeis.org

1, 0, 0, 2, 4, 0, 2, 6, 12, 4, 0, 8, 10, 2, 6, 14, 28, 12, 4, 20, 16, 0, 8, 24, 26, 10, 2, 18, 22, 6, 14, 30, 60, 28, 12, 44, 36, 4, 20, 52, 48, 16, 0, 32, 40, 8, 24, 56, 58, 26, 10, 42, 34, 2, 18, 50, 54, 22, 6, 38, 46, 14, 30, 62, 124, 60, 28, 92, 76, 12, 44, 108, 100, 36, 4, 68, 84, 20, 52, 116, 112, 48, 16, 80, 64, 0, 32, 96, 104, 40, 8, 72, 88, 24, 56, 120
Offset: 0

Author

Indranil Ghosh, Jan 23 2017

Keywords

Examples

			For n = 11, the binary reflected Gray code for 11 is '1110' which after interchanging the 1's and 0's becomes '0001', which on reversing further gives '1000'. Now, 1000_2 = 8_10. So, a(11) = 8.
		

Crossrefs

Programs

  • Mathematica
    Table[FromDigits[Reverse@ IntegerDigits[#, 2] &@ BitXor[n, Floor[n/2]] /. { 0 -> 1, 1 -> 0}, 2], {n, 0, 120}] (* Michael De Vlieger, Jan 23 2017 *)
  • Python
    def G(n):
        return bin(n^(n/2))[2:]
    def a(n):
        s=""
        x=G(n)
        for i in x:
            if i=="1":s+="0"
            else:s+="1"
        s=s[::-1]
        return int(s,2)

Formula

a(n) = A036044(A003188(n)).

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

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)).

A281382 Numbers n such that the decimal equivalent of the binary reflected Gray code representation of n is a palindromic prime.

Original entry on oeis.org

2, 3, 5, 6, 13, 70, 213, 217, 229, 253, 422, 426, 446, 465, 534, 541, 705, 741, 857, 869, 8441, 8481, 9190, 9221, 9293, 10210, 10349, 10453, 10929, 11049, 12006, 12281, 12329, 12721, 12793, 14109, 14282, 20578, 20934, 21009, 21629, 21701, 22810, 22866, 23221, 23421, 28705, 29397
Offset: 1

Author

Indranil Ghosh, Jan 21 2017

Keywords

Comments

Numbers n such that A003188(n) is both prime and palindromic.

Examples

			213 is in the sequence because A003188(213) = 191 and 191 is a palindromic prime.
		

Crossrefs

Programs

  • Mathematica
    Select[Range@ 30000, And[PrimeQ@ #, Reverse@ # == # &@ IntegerDigits@ #] &@ BitXor[#, Floor[#/2]] &] (* Michael De Vlieger, Mar 30 2017 *)
  • Python
    from sympy import isprime
    def G(n):
        return int(bin(n^(n//2))[2:],2)
    i=0
    j=1
    while j<=1281:
        if G(i)==int(str(G(i))[::-1]) and isprime(G(i))==True:
            print(j, i)
            j+=1
        i+=1