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 41-50 of 66 results. Next

A264618 Working in binary, write n followed by 0 then n-reversed (including leading zeros); show result in base 10.

Original entry on oeis.org

0, 5, 17, 27, 65, 85, 99, 119, 257, 297, 325, 365, 387, 427, 455, 495, 1025, 1105, 1161, 1241, 1285, 1365, 1421, 1501, 1539, 1619, 1675, 1755, 1799, 1879, 1935, 2015, 4097, 4257, 4369, 4529, 4617, 4777, 4889, 5049, 5125, 5285, 5397, 5557, 5645, 5805, 5917, 6077, 6147, 6307, 6419, 6579, 6667, 6827, 6939, 7099, 7175
Offset: 0

Views

Author

N. J. A. Sloane, Nov 30 2015

Keywords

Comments

a(n) = A264619(n) - A062383(n); n>0: A070939(a(n)) = 2*A070939(n)+1; A000120(a(n)) = 2*A000120(n); n>0: A023416(a(n)) = 2*A023416(n)+1. - Reinhard Zumkeller, Dec 01 2015

Examples

			0 -> 000 = 0,
1 -> 101 = 5,
10 -> 10001 = 17,
11 -> 11011 = 27,
100 -> 1000001 = 65,
...
		

Crossrefs

Cf. A006995, A048701 (n followed by n-reversed), A264619.
First differences: A265028.

Programs

  • Haskell
    a264618 n = foldr (\b v -> 2 * v + b) 0 $ (reverse bs ++ (0 : bs))
                where bs = map fromIntegral $ a030308_row n
    -- Reinhard Zumkeller, Dec 01 2015
  • Mathematica
    A264618[n_]:=FromDigits[Join[#, {0}, Reverse[#]], 2] &@IntegerDigits[n, 2] (* JungHwan Min, Dec 01 2015 *)

A264619 a(0) = 1; for n>0, working in binary, write n followed by 1 then n-reversed (including leading zeros); show result in base 10.

Original entry on oeis.org

1, 7, 21, 31, 73, 93, 107, 127, 273, 313, 341, 381, 403, 443, 471, 511, 1057, 1137, 1193, 1273, 1317, 1397, 1453, 1533, 1571, 1651, 1707, 1787, 1831, 1911, 1967, 2047, 4161, 4321, 4433, 4593, 4681, 4841, 4953, 5113, 5189, 5349, 5461, 5621, 5709, 5869, 5981, 6141, 6211, 6371, 6483, 6643, 6731, 6891, 7003, 7163, 7239
Offset: 0

Views

Author

N. J. A. Sloane, Nov 30 2015

Keywords

Comments

a(n) = A062383(n) + A264618(n); n>0: A070939(a(n)) = 2*A070939(n)+1; A000120(a(n)) = 2*A000120(n)+1; n>0: A023416(a(n)) = 2*A023416(n). - Reinhard Zumkeller, Dec 01 2015

Examples

			1 -> 111 = 7,
10 -> 10101 = 21,
11 -> 11111 = 31,
100 -> 1001001 = 73,
...
		

Crossrefs

Cf. A006995, A048701 (n followed by n-reversed), A264618.
First differences: A265029.

Programs

  • Haskell
    a264619 0 = 1
    a264619 n = foldr (\b v -> 2 * v + b) 0 $ (reverse bs ++ (1 : bs))
                where bs = map fromIntegral $ a030308_row n
    -- Reinhard Zumkeller, Dec 01 2015
  • Mathematica
    A264619[0] = 1; A264619[n_] := FromDigits[Join[#, {1}, Reverse[#]], 2]&@ IntegerDigits[n, 2] (* JungHwan Min, Dec 01 2015 *)
    bnr[n_]:=Module[{idn2=IntegerDigits[n,2]},FromDigits[Join[idn2,{1}, Reverse[ idn2]],2]]; Join[{1},Array[bnr,60]] (* Harvey P. Dale, Nov 05 2017 *)

A340632 a(n) in binary is a run of 1-bits from the most significant 1-bit of n down to the least significant 1-bit of n, inclusive.

Original entry on oeis.org

0, 1, 2, 3, 4, 7, 6, 7, 8, 15, 14, 15, 12, 15, 14, 15, 16, 31, 30, 31, 28, 31, 30, 31, 24, 31, 30, 31, 28, 31, 30, 31, 32, 63, 62, 63, 60, 63, 62, 63, 56, 63, 62, 63, 60, 63, 62, 63, 48, 63, 62, 63, 60, 63, 62, 63, 56, 63, 62, 63, 60, 63, 62, 63, 64, 127, 126
Offset: 0

Views

Author

Kevin Ryde, Jan 13 2021

Keywords

Examples

			n    = 172 = binary 10101100;
a(n) = 252 = binary 11111100.
		

Crossrefs

Cf. A023758 (distinct terms).

Programs

  • PARI
    a(n) = if(n, 2<
    				
  • Python
    def a(n): return (1<
    				

Formula

a(n) = A062383(n) - A006519(n) for n>=1.
a(n) = A003817(n) - A135481(n-1).
a(n) = n + A334045(n) (filling in 0-bits, including n=0 by taking A334045(0)=0).
a(n) = A142151(n-1) + 1.
G.f.: x/(1-x) + Sum_{k>=0} 2^k*x^(2^k)*(1/(1-x) - 1/(1-x^(2^(k+1)))).

A065160 Reduced binary string self-substitutions: a(n) is obtained by substituting n for each 1-bit in the binary expansion of n, then dividing by n.

Original entry on oeis.org

1, 2, 5, 4, 17, 18, 73, 8, 65, 66, 529, 68, 545, 546, 4369, 16, 257, 258, 4129, 260, 4161, 4162, 66593, 264, 4225, 4226, 67617, 4228, 67649, 67650, 1082401, 32, 1025, 1026, 32833, 1028, 32897, 32898, 1052737, 1032, 33025, 33026, 1056833, 33028, 1056897
Offset: 1

Views

Author

Marc LeBrun, Oct 18 2001

Keywords

Comments

By convention a(0)=0. a(2^n)=2^n. a(4n+2)=1+a(4n+1). a(n)=A065158(n,n)=A065157(n,n)/n=A065159(n)/n.

Examples

			a(5): 5=101->(101)0(101)=1010101=85; 85/5=17.
		

Crossrefs

Cf. A065157, A065158. Equals A065159(n)/n.

Formula

a(2^n)=2^n. a(4n+2)=1+a(4n+1). a(n)=A065158(n, n)=A065157(n, n)/n=A065159(n)/n.
a(n)=z(n, A062383(n)) with z(u, v) = if u=0 then 0 else if u mod 2 = 0 then z(u/2, v)*2 else z([u/2], v)*v+1. - Reinhard Zumkeller, Feb 15 2004

A065285 The siteswap sequence (the deltas p[i]-i, i in ]-inf,+inf[, folded from Z to N, mapping 0->1, 1->2, -1->3, 2->4, -2->5, etc.) for A065284.

Original entry on oeis.org

0, 2, 2, 4, 4, 4, 2, 8, 8, 8, 10, 8, 4, 8, 4, 16, 16, 16, 18, 16, 20, 16, 22, 16, 8, 16, 8, 16, 8, 16, 8, 32, 32, 32, 34, 32, 36, 32, 38, 32, 40, 32, 42, 32, 44, 32, 46, 32, 16, 32, 16, 32, 16, 32, 16, 32, 16, 32, 16, 32, 16, 32, 16, 64, 64, 64, 66, 64, 68, 64, 70, 64, 72, 64, 74
Offset: 1

Views

Author

Antti Karttunen, Oct 28 2001

Keywords

Crossrefs

The bisection of even terms (the positive half of Z) is given by A062383 and the bisection of odd terms (the nonpositive half of Z) is given by A065286.

A099894 XOR BINOMIAL transform of A038712.

Original entry on oeis.org

1, 2, 0, 4, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Offset: 0

Views

Author

Paul D. Hanna, Oct 29 2004

Keywords

Comments

See A099884 for the definitions of the XOR BINOMIAL transform and the XOR difference triangle.
a(n) = A062383(n+1) - A062383(n). - Reinhard Zumkeller, Aug 06 2009
A038712 has offset 1, but we need to use offset 0 for the XOR BINOMIAL. - Michael Somos, Dec 30 2016

Examples

			G.f. = 1 + 2*x + 4*x^3 + 8*x^7 + 16*x^15 + 32*x^31 + 64*x^63 + 128*x^127 + ...
XOR difference triangle of A038712 begins:
[1],
[3,2],
[1,2,0],
[7,6,4,4],
[1,6,0,4,0],
[3,2,4,4,0,0],
[1,2,0,4,0,0,0],
[15,14,12,12,8,8,8,8],...
where A038712 is in the leftmost column and A099894 (this sequence) forms the main diagonal.
a(1) = 1*1 XOR 0*1 = 1, a(2) = 1*1 XOR 0*3 XOR 1*1 = 0, a(3) = 1*1 XOR 1*3 XOR 1*1 XOR 1*7 = 4 where (1, 3, 1, 7) are the first four terms of A038712. - _Michael Somos_, Dec 30 2016
		

Crossrefs

Programs

  • Mathematica
    a[ n_] := With[ {m = n+1}, If[ m >=0 && Total[ IntegerDigits[ m, 2]] == 1, m, 0]]; (* Michael Somos, Dec 30 2016 *)
  • PARI
    {a(n)=local(B);B=0;for(i=0,n,B=bitxor(B,binomial(n,i)%2*A038712(n-i) ));B}
    
  • PARI
    {a(n) = my(m = n+1); m * ( m>=0 && hammingweight(m) == 1)}; /* Michael Somos, Dec 30 2016 */

Formula

a(2^n-1) = 2^n for n>=0 and a(k)=0 otherwise. a(n) = SumXOR_{i=0..n} (C(n, i)mod 2)*A038712(n-i) and SumXOR is summation under XOR.
a(n) = A048298(n+1). - Michael Somos, Dec 30 2016

A195467 Consecutive powers of the Gray code permutation.

Original entry on oeis.org

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

Views

Author

Tilman Piesk, Sep 23 2011

Keywords

Comments

The powers of the Gray code permutation (GCP, A003188) form an infinite array, where row n is the n-th power of the GCP. Row 0 is the identity permutation (i.e., the sequence of nonnegative integers), and row 1 is the GCP itself.
The different powers of the n-bit GCP form a matrix of size (A062383(n-1)) X (2^n).
This sequence represents the infinite array in a somewhat redundant way: It shows the rows of all the (2^n) X (2^2^n) matrices of powers of (2^n)-bit GCP. So this sequence forms a triangle, and these 3 matrices are its first 7 rows:
The 1-bit GCP is the identity permutation:
0: 0 1
The 2 different powers of the 2-bit GCP:
0: 0 1 2 3
1: 0 1 3 2
The 4 different powers of the 4-bit GCP:
0: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
1: 0 1 3 2 6 7 5 4 12 13 15 14 10 11 9 8
2: 0 1 2 3 5 4 7 6 10 11 8 9 15 14 13 12
3: 0 1 3 2 7 6 4 5 15 14 12 13 8 9 11 10
.
This array A can be defined using the binary array B = A197819 by
A = B + 2 * 2stretched(B) + 4 * 4stretched(B) + 8 * 8stretched(B) + ...
where nstretched has the following meaning:
2stretched(1,2,3,4,...) = 1,1,2,2,3,3,4,4,...
4stretched(1,2,3,4,...) = 1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,...
etc.

Crossrefs

Cf. A003188 (Gray code permutation).
Cf. A006068 (inverse of the Gray code permutation).
Cf. A064706 (square of the Gray code permutation).
Cf. A197819 (this array mod 2).

Extensions

Huge edit by Tilman Piesk, Aug 25 2013

A240769 Triangle read by rows: T(1,1) = 1; T(n+1,k) = T(n,k+1), 1 <= k < n; T(n+1,n) = 2*T(n,1); T(n+1,n+1) = 2*T(n,1) - 1.

Original entry on oeis.org

1, 2, 1, 1, 4, 3, 4, 3, 2, 1, 3, 2, 1, 8, 7, 2, 1, 8, 7, 6, 5, 1, 8, 7, 6, 5, 4, 3, 8, 7, 6, 5, 4, 3, 2, 1, 7, 6, 5, 4, 3, 2, 1, 16, 15, 6, 5, 4, 3, 2, 1, 16, 15, 14, 13, 5, 4, 3, 2, 1, 16, 15, 14, 13, 12, 11, 4, 3, 2, 1, 16, 15, 14, 13, 12, 11, 10, 9, 3, 2
Offset: 1

Views

Author

Reinhard Zumkeller, Apr 13 2014

Keywords

Comments

Let h be the initial term of row n, to get row n+1, remove h and then append 2*h and 2*h+1;
A080079(n) = T(n,1); T(n,T(n,1)) = 1.

Examples

			.   1:   1
.   2:   2   1
.   3:   1   4   3
.   4:   4   3   2   1
.   5:   3   2   1   8   7
.   6:   2   1   8   7   6   5
.   7:   1   8   7   6   5   4   3
.   8:   8   7   6   5   4   3   2   1
.   9:   7   6   5   4   3   2   1  16  15
.  10:   6   5   4   3   2   1  16  15  14  13
.  11:   5   4   3   2   1  16  15  14  13  12  11
.  12:   4   3   2   1  16  15  14  13  12  11  10   9 .
		

Crossrefs

Cf. A062383 (row maxima).

Programs

  • Haskell
    a240769 n k = a240769_tabl !! (n-1) !! (k-1)
    a240769_row n = a240769_tabl !! (n-1)
    a240769_tabl = iterate (\(x:xs) -> xs ++ [2*x, 2*x-1]) [1]

A300428 a(n) is the least positive k such that the binary representation of n appears as a substring in the binary representation of 1/k (ignoring the radix point and adding trailing zeros if necessary in case of a terminating expansion).

Original entry on oeis.org

1, 1, 5, 1, 3, 5, 9, 1, 5, 3, 11, 5, 11, 9, 17, 1, 9, 7, 5, 11, 3, 13, 11, 9, 5, 11, 13, 9, 11, 17, 33, 1, 17, 11, 9, 7, 19, 5, 13, 11, 29, 3, 19, 13, 27, 11, 19, 17, 9, 19, 5, 11, 19, 13, 29, 9, 19, 11, 13, 17, 25, 33, 65, 1, 33, 23, 17, 13, 11, 29, 9, 23, 7
Offset: 1

Views

Author

Rémy Sigrist, Mar 05 2018

Keywords

Comments

In other words, a(n) is the least k > 0 such that floor((2^i) / k) mod A062383(n) = n for some integer i >= 0.
This sequence is similar to A035335 for the base 2.
All terms are odd.
All terms appears infinitely many times (as a(n) equals at least a(2*n) or a(2*n + 1)).
See also A300475 for a similar sequence.

Examples

			The first terms, alongside the binary representation of 1/a(n) with the earliest occurrence of the binary representation of n in parentheses, are:
  n  a(n)    bin(1/a(n))
  -- ----    -----------
   1    1    (1).000...
   2    1    (1.0)000...
   3    5    0.00(11)001...
   4    1    (1.00)000...
   5    3    0.0(101)010...
   6    5    0.00(110)011...
   7    9    0.000(111)000...
   8    1    (1.000)000...
   9    5    0.001(1001)100...
  10    3    0.0(1010)101...
  11   11    0.000(1011)101...
  12    5    0.00(1100)110...
  13   11    0.000101(1101)000...
  14    9    0.000(1110)001...
  15   17    0.0000(1111)000...
  16    1    (1.0000)000...
  17    9    0.00011(10001)110...
  18    7    0.00(10010)010...
  19    5    0.001(10011)001...
  20   11    0.0001011(10100)010...
		

Crossrefs

Programs

  • PARI
    See Links section.

Formula

a(2^k) = 1 for any k >= 0.
a(2^k - 1) = 2^k + 1 for any k > 1.
a(A000975(k)) = 3 for any k > 2.
a(A033138(k)) = 7 for any k > 4.
a(n) <= A300475(n) for any n > 0.

A359303 Bitwise encoding of the state of a 1D cellular automaton after n steps from ...111000... where adjacent cells swap 01 <-> 10 when within triples 110 or 011.

Original entry on oeis.org

1, 3, 5, 11, 13, 39, 43, 45, 103, 155, 171, 173, 359, 411, 619, 669, 1367, 1371, 1387, 1437, 3287, 4923, 5339, 5467, 5483, 5533, 11479, 13115, 19675, 21339, 21739, 21853, 43735, 43835, 44251, 45915, 52459, 78685, 170455, 173755, 174555, 174811, 174939, 175339, 176989, 367063, 419515, 629211
Offset: 1

Views

Author

Raphael J. F. Berger, Dec 25 2022

Keywords

Comments

This automaton is a toy model for diffusion. It is inspired by the "Unstable Diffusion" problem encountered on day 23 of the "Advent of Code 2022" challenge and it serves as a 1D counterpart to the 2D cellular automaton featured there.
The state is a bi-infinite string of 1's and 0's of the form ...1111 middle 0000...
The state is encoded in an integer by discarding the left infinite 1's and one 0 which follows, then interpret the rest left-to-right as binary least- to most-significant bit.
The state steps by locating all cells which will swap, and applying those swaps simultaneously.
In pattern 110, the 10 cells swap to become 01, and conversely in pattern 011 the 01 cells swap to become 10.
Patterns can overlap so that, for example, 0110 is an 011 and a 110 and the two swaps step to 1001.
Swaps conflict in a pattern 11011 since they try to swap the 0 both to the left and to the right. When this happens, neither of these conflicting swaps are applied.
At least one swap always occurs since the rightmost 11 pair is followed by 0 and this 110 has no further 11 after which would conflict.
The total number of 1's and 0's is preserved in each state (when taking some large enough part of the bi-infinite state).

Examples

			For n=1, the starting state steps by a single swap, marked (), and the resulting string excluding left ...1110 is the bits of a(1) = 1,
  start      ...11110000...
                   ()
  a(1) = 1 = ...11101000...
                    \---> bits 100...
Conflicting swaps are seen at n=2 in pattern 11011. Its 101 is unchanged, but the right 11 is also part of a 110 and it does swap,
  a(2) = 3 = ...11110110000...
                   CCC()
  a(3) = 5 = ...11110101000...
                     \---> bits 101... = 5
Bit encoding direction, least- to most-significant, is seen at n=5,
  a(5) = 13 = ...1111010110000...
                      \--->  bits 1011
Overlapping swaps in pattern 0110 are seen at n=8,
  a(8) = 45 =   ...111101011010000...
                      () ()()
  a(9) = 103 = ...1111011100110000...
		

Crossrefs

Programs

  • Mathematica
    ClearAll[{s,prop,checkprop,doprop,run,p,pa,a,j}];
    prop[s_]:=(p=Array[0#&,Length[s]];
    Do[If[i==1 ||i==Length[s],p[[i]]=0,
       {p[[i-1]],p[[i]],p[[i+1]]}+=
      Piecewise[{{{1,-1,0},{s[[i-1]],s[[i]],s[[i+1]]}=={0,1,1}},
                            {{0,-1,1},{s[[i-1]],s[[i]],s[[i+1]]}=={1,1,0}}},{0,0,0}]],{i,1,Length[s]-1} ];
                                      Return[p])
    checkprop[s_]:=(p=s;
                                              Do[If[p[[i]]==2,{p[[i-1]],p[[i]],p[[i+1]]}={0,0,0}],{i,2,Length[s]-1}];
                                              Return[p])
    doprop[s_]:= Return[s +checkprop[prop[s]]]
    (* the cellular automaton starting with n+5 "1" cells and n+5 "0" cells *)
    run[n_]:=( s=Join[Array[#/#&,n+5],Array[0#&,n+5]] ;Table[Nest[doprop[#]&,s,k],{k,0,n}])
    (*conversion from the automaton states to integers *)
    (* a[10] returns {1,3,5,11,13,39,43,45,103} *)
    a[j_]:=Table[FromDigits[Reverse[run[j+1][[k,All]]/.{Longest[1 ...], x___} :> {x}],2]/2,{k,2,j+1}]
  • PARI
    \\ See links.

Formula

a(n) = A030101(A035327(A360142(n))) + A360141(n) * A062383(A035327(A360142(n))), being reconstruction from left half (A360141) and right half (A360142). - Raphael J. F. Berger, Jun 21 2023
Previous Showing 41-50 of 66 results. Next