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.

Previous Showing 21-29 of 29 results.

A137305 Write n in base 3, change twos in ones and ones in twos, reverse.

Original entry on oeis.org

0, 2, 1, 2, 8, 5, 1, 7, 4, 2, 20, 11, 8, 26, 17, 5, 23, 14, 1, 19, 10, 7, 25, 16, 4, 22, 13, 2, 56, 29, 20, 74, 47, 11, 65, 38, 8, 62, 35, 26, 80, 53, 17, 71, 44, 5, 59, 32, 23, 77, 50, 14, 68, 41, 1, 55, 28, 19, 73, 46, 10
Offset: 0

Views

Author

Jonathan Vos Post, Apr 20 2008

Keywords

Comments

This is not to A036044 as A007089 is to A007088: despite similarity here the operation performed is not a base 3 complement. Fixed points begin: 5, 7, 11, 19, 29, 44, 50, 55.

Examples

			53 -> 1222 -> 2111 -> 1112 -> 41.
		

Crossrefs

Programs

  • Maple
    a:= proc(n) local m, r; m, r:= n, 0; while m>0
          do r:=r*3+[0, 2, 1][1+irem(m, 3, 'm')] od; r
        end:
    seq(a(n), n=0..100);  # Alois P. Heinz, Jun 20 2016
  • Mathematica
    a[n_] := FromDigits[ Reverse[ IntegerDigits[n, 3] /. {1 -> 2, 2 -> 1}], 3] (* Giovanni Resta, Jun 20 2016 *)

Formula

a(3^n) = 2. a(2*3^n) = 1.

Extensions

Edited and corrected by Giovanni Resta, Jun 20 2016

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

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

Views

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

A284801 Write in base k, complement, reverse. Case k = 5.

Original entry on oeis.org

4, 3, 2, 1, 0, 23, 18, 13, 8, 3, 22, 17, 12, 7, 2, 21, 16, 11, 6, 1, 20, 15, 10, 5, 0, 123, 98, 73, 48, 23, 118, 93, 68, 43, 18, 113, 88, 63, 38, 13, 108, 83, 58, 33, 8, 103, 78, 53, 28, 3, 122, 97, 72, 47, 22, 117, 92, 67, 42, 17, 112, 87, 62, 37, 12, 107, 82
Offset: 0

Views

Author

Paolo P. Lava, Apr 03 2017

Keywords

Examples

			a(11) = 17 because 11 in base 5 is 21, its complement in base 5 is 23 and the digit reverse is 32 that is 17 in base 10.
		

Crossrefs

Programs

  • Maple
    P:=proc(q,h) local a,b,k,n; print(h-1); for n from 1 to q do a:=convert(n,base,h); b:=0;
    for k from 1 to nops(a) do a[k]:=h-1-a[k]; b:=h*b+a[k]; od; print(b); od; end: P(10^2,5);

A284803 Write in base k, complement, reverse. Case k = 6.

Original entry on oeis.org

5, 4, 3, 2, 1, 0, 34, 28, 22, 16, 10, 4, 33, 27, 21, 15, 9, 3, 32, 26, 20, 14, 8, 2, 31, 25, 19, 13, 7, 1, 30, 24, 18, 12, 6, 0, 214, 178, 142, 106, 70, 34, 208, 172, 136, 100, 64, 28, 202, 166, 130, 94, 58, 22, 196, 160, 124, 88, 52, 16, 190, 154, 118, 82, 46
Offset: 0

Views

Author

Paolo P. Lava, Apr 03 2017

Keywords

Examples

			a(13) = 27 because 13 in base 6 is 21, its complement in base 6 is 34 and the digit reverse is 43 that is 27 in base 10.
		

Crossrefs

Programs

  • Maple
    P:=proc(q,h) local a,b,k,n; print(h-1); for n from 1 to q do a:=convert(n,base,h); b:=0;
    for k from 1 to nops(a) do a[k]:=h-1-a[k]; b:=h*b+a[k]; od; print(b); od; end: P(10^2,6);
  • Mathematica
    Table[FromDigits[Reverse[5-IntegerDigits[n,6]],6],{n,0,70}] (* Harvey P. Dale, Jan 05 2020 *)

Extensions

Example corrected by Harvey P. Dale, Jan 05 2020

A284805 Write in base k, complement, reverse. Case k = 7.

Original entry on oeis.org

6, 5, 4, 3, 2, 1, 0, 47, 40, 33, 26, 19, 12, 5, 46, 39, 32, 25, 18, 11, 4, 45, 38, 31, 24, 17, 10, 3, 44, 37, 30, 23, 16, 9, 2, 43, 36, 29, 22, 15, 8, 1, 42, 35, 28, 21, 14, 7, 0, 341, 292, 243, 194, 145, 96, 47, 334, 285, 236, 187, 138, 89, 40, 327, 278, 229, 180
Offset: 0

Views

Author

Paolo P. Lava, Apr 03 2017

Keywords

Examples

			a(14) = 46 because 14 in base 7 is 20, its complement in base 7 is 46 and the digit reverse is 64 that is 46 in base 10.
		

Crossrefs

Programs

  • Maple
    P:=proc(q,h) local a,b,k,n; print(h-1); for n from 1 to q do a:=convert(n,base,h); b:=0;
    for k from 1 to nops(a) do a[k]:=h-1-a[k]; b:=h*b+a[k]; od; print(b); od; end: P(10^2,7);

A284809 Write in base k, complement, reverse. Case k = 9.

Original entry on oeis.org

8, 7, 6, 5, 4, 3, 2, 1, 0, 79, 70, 61, 52, 43, 34, 25, 16, 7, 78, 69, 60, 51, 42, 33, 24, 15, 6, 77, 68, 59, 50, 41, 32, 23, 14, 5, 76, 67, 58, 49, 40, 31, 22, 13, 4, 75, 66, 57, 48, 39, 30, 21, 12, 3, 74, 65, 56, 47, 38, 29, 20, 11, 2, 73, 64, 55, 46, 37, 28, 19
Offset: 0

Views

Author

Paolo P. Lava, Apr 03 2017

Keywords

Examples

			a(14) = 34 because 14 in base 9 is 15, its complement in base 9 is 73 and the digit reverse is 37 that is 34 in base 10.
		

Crossrefs

Programs

  • Maple
    P:=proc(q,h) local a,b,k,n; print(h-1); for n from 1 to q do a:=convert(n,base,h); b:=0;
    for k from 1 to nops(a) do a[k]:=h-1-a[k]; b:=h*b+a[k]; od; print(b); od; end: P(10^2,9);
  • Mathematica
    Table[FromDigits[Reverse[8-#&/@IntegerDigits[n,9]],9],{n,0,70}] (* Harvey P. Dale, Mar 12 2023 *)

A368671 For any k >= 0, let P(k) = A368357(k) and P(-k) = A368358(k); for any n > 0, a(n) is the unique k such that P(k) = n.

Original entry on oeis.org

0, 1, 2, -1, -3, -2, -4, 3, 7, 5, 9, 4, 8, 6, 10, -5, -13, -9, -17, -7, -15, -11, -19, -6, -14, -10, -18, -8, -16, -12, -20, 11, 27, 19, 35, 15, 31, 23, 39, 13, 29, 21, 37, 17, 33, 25, 41, 12, 28, 20, 36, 16, 32, 24, 40, 14, 30, 22, 38, 18, 34, 26, 42, -21
Offset: 1

Views

Author

Rémy Sigrist, Jan 02 2024

Keywords

Comments

This sequence is a bijection from the positive integers to the integers (Z).

Examples

			P(2) = A368357(2) = 3, so a(3) = 2.
P(-4) = A368358(4) = 7, so a(7) = -4.
		

Crossrefs

Programs

  • PARI
    \\ See Links section.

Formula

Conjecture: a(n) = (-1)^(L(n)+1)*(A001045(L(n)+2) - A036044(n)/2 - 1) for n > 0 where L(n) = A000523(n). - Mikhail Kurkov, Dec 13 2024

A279624 Numbers x such that BCR(x) = R(x), where BCR = binary-complement-and-reverse = take one's complement then reverse bit order and R(x) is the digits reverse of n.

Original entry on oeis.org

2, 61, 212, 232, 666, 868, 2222, 642246, 687588, 820491, 885786, 2283822, 2459542, 2807082, 2860682, 45377354, 214878412, 841191148, 841740971, 49126162194
Offset: 1

Views

Author

Paolo P. Lava, Dec 16 2016

Keywords

Examples

			687588 in base 2 is 10100111110111100100. Its binary-complement-and-reverse is 11011000010000011010, which is 885786 in base 10.
		

Crossrefs

Programs

  • Maple
    with(numtheory): T:=proc(w) local x, y, z; x:=w; y:=0;
    for z from 1 to ilog10(x)+1 do y:=10*y+(x mod 10); x:=trunc(x/10); od; y; end:
    P:=proc(q) local a,b, k,n; for n from 1 to q do a:=convert(n,base,2); b:=0;
    for k from 1 to nops(a) do if a[k]=0 then a[k]:=1 else a[k]:=0; fi; b:=2*b+a[k]; od;
    if b=n then print(n); fi; od; end: P(10^6);
  • Mathematica
    Select[Range[10^6], MatchQ @@ {FromDigits[#, 2] &@ Reverse[ IntegerDigits[#, 2] /. {0 -> 1, 1 -> 0}], FromDigits@ Reverse@ IntegerDigits@ #} &] (* Michael De Vlieger, Dec 16 2016 *)

Extensions

a(17)-a(20) from Hans Havermann, Dec 23 2016
Previous Showing 21-29 of 29 results.