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

A171008 Write the n-th prime in binary and change all 0's to 1's and all 1's to 0's.

Original entry on oeis.org

1, 0, 10, 0, 100, 10, 1110, 1100, 1000, 10, 0, 11010, 10110, 10100, 10000, 1010, 100, 10, 111100, 111000, 110110, 110000, 101100, 100110, 11110, 11010, 11000, 10100, 10010, 1110, 0, 1111100, 1110110, 1110100, 1101010, 1101000, 1100010, 1011100
Offset: 1

Views

Author

N. J. A. Sloane, Sep 03 2010

Keywords

Crossrefs

See A145382 for the decimal equivalents.

Programs

  • Maple
    A171008 := proc(n) local p2 ; p2 := convert(ithprime(n),base,2) ; add( (1-op(i,p2)) *10^(i-1),i=1..nops(p2)) ; end proc: seq(A171008(n),n=1..80) ; # R. J. Mathar, Sep 04 2010
  • Mathematica
    FromDigits/@(IntegerDigits[#,2]&/@Prime[Range[40]]/.{0->1,1->0}) (* Harvey P. Dale, Aug 19 2017 *)
  • PARI
    a(n)=my(v=binary(prime(n)),k=1/10);sum(i=0,#v-1,k*=10;(1-v[ #v-i])*k) \\ Charles R Greathouse IV, Sep 08 2010

Extensions

More terms from Charles R Greathouse IV and R. J. Mathar, Sep 04 2010

A334143 a(n) = bitwise NOR of prime(n) and prime(n+1).

Original entry on oeis.org

0, 0, 0, 0, 0, 2, 12, 8, 0, 0, 0, 18, 20, 16, 0, 0, 0, 0, 56, 48, 48, 32, 36, 6, 26, 24, 16, 16, 2, 0, 0, 116, 116, 96, 104, 96, 64, 88, 80, 64, 72, 64, 0, 58, 56, 40, 32, 0, 24, 18, 16, 0, 4, 4, 248, 240, 240, 224, 226, 228, 192, 200, 200, 192, 194, 128, 164
Offset: 1

Views

Author

Christoph Schreier, Apr 15 2020

Keywords

Examples

			a(6) = prime(6) NOR prime(7) = 13 NOR 17 = 2.
		

Crossrefs

Programs

  • Maple
    a:= n-> Bits[Nor](ithprime(n), ithprime(n+1)):
    seq(a(n), n=1..70);  # Alois P. Heinz, Apr 15 2020
  • Mathematica
    A334143[n_]:=With[{b=BitOr[Prime[n],Prime[n+1]]},2^BitLength[b]-b-1];Array[A334143,100] (* Paolo Xausa, Oct 13 2023 *)
  • PARI
    a(n) = my(x=bitor(prime(n), prime(n+1))); bitneg(x, #binary(x)); \\ Michel Marcus, Apr 16 2020
  • Python
    def NORprime(n):
        s = str(bin(primes[n]))[2:]
        t = str(bin(primes[n-1]))[2:]
        k = (len(s) -  len(t))
        t = k*'0' + t
        r = ''
        for i in range(len(s)):
            if s[i] == t[i] and s[i] == '0':
                r += '1'
            else:
                r += '0'
        return int(r,2)
    

Formula

a(n) = A035327(A175329(n)).

A159006 Transformation of prime(n): flip digits in the binary representation, revert the sequence of digits, and convert back to decimal.

Original entry on oeis.org

2, 0, 2, 0, 2, 4, 14, 6, 2, 8, 0, 22, 26, 10, 2, 20, 8, 16, 30, 14, 54, 6, 26, 50, 60, 44, 12, 20, 36, 56, 0, 62, 110, 46, 86, 22, 70, 58, 26, 74, 50, 82, 2, 124, 92, 28, 52, 4, 56, 88, 104, 8, 112, 32, 254, 62, 158, 30, 174, 206, 78, 182, 102, 38, 198, 134, 90, 234, 74, 138, 242
Offset: 1

Views

Author

Keywords

Comments

Write the n-th prime in binary as in A004676. Change all 0's to 1's and all 1's to 0's to reach A145382. Read the binary digits from right to left. a(n) is the decimal equivalent of the result.
All entries are even, i.e., members of A005843.

Examples

			37->100101->change digits 011010->read from right to left 010110->22 281->100011001->change digits 011100110->read from right to left 011001110->206
		

Crossrefs

Programs

  • Maple
    P:=proc(i) local a,b,j,k,n; for n from 1 by 1 to i do a:=convert(ithprime(n), binary); j:=length(a); b:=convert(a,string); k:=""; while j>0 do if substring(b,j)="1" then k:=cat(k,"0"); else k:=cat(k,"1"); fi; j:=j-1; od; a:=convert(k,decimal,binary); print(a); od; end: P(100);
  • Mathematica
    FromDigits[Reverse@ BitNot@ IntegerDigits[#, 2] + 2, 2] & /@ Prime@ Range@ 71 (* Michael De Vlieger, Apr 22 2015 *)
  • PARI
    a(n)=fromdigits(Vecrev(apply(n->1-n,binary(prime(n)))),2) \\ Charles R Greathouse IV, Apr 22 2015
    
  • Python
    from sympy import prime
    def A159006(n): return -int((s:=bin(prime(n))[-1:1:-1]),2)-1+2**len(s) # Chai Wah Wu, Feb 04 2022

Formula

a(n) = A036044(prime(n)). - Michel Marcus, Apr 22 2015

Extensions

Edited by R. J. Mathar, Apr 06 2009
Showing 1-3 of 3 results.