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

A164056 Triangle of 2^n terms by rows, derived from A088696 as to length of continued fractions, lengths increase = 1, decrease = 0. A088696 can be generated using the following algorithm: Rows 0 and 1 begin 1; 1,2; then for all further rows, bring down current row then append to the right: (1 added to each term in current row). Row 2 (1, 2, 3, 2) then becomes: (1, 2, 3, 2, 3, 4, 3, 2).

Original entry on oeis.org

0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0
Offset: 0

Views

Author

Gary W. Adamson, Aug 08 2009

Keywords

Comments

Complement of the sequence = A164057

Examples

			A088696 begins:
1;
1, 2;
1, 2, 3, 2;
1, 2, 3, 2, 3, 4, 3, 2;
...
Triangle A164056 =
0;
0, 1;
0, 1, 1, 0;
0, 1, 1, 0, 1, 1, 0, 0;
0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0;
...
		

Crossrefs

Programs

Formula

Given number of terms in half of the Stern-Brocot infinite Farey tree (cf. A088696); left the leftmost term in each row = 0, then the next term = 1 if the next corresponding positional term in A088696 increases; otherwise 0.

Extensions

More terms from Jon Maiga, Sep 30 2019
Keyword tabf from Michel Marcus, Sep 30 2019

A005811 Number of runs in binary expansion of n (n>0); number of 1's in Gray code for n.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Starting with a(1) = 0 mirror all initial 2^k segments and increase by one.
a(n) gives the net rotation (measured in right angles) after taking n steps along a dragon curve. - Christopher Hendrie (hendrie(AT)acm.org), Sep 11 2002
This sequence generates A082410: (0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, ...) and A014577; identical to the latter except starting 1, 1, 0, ...; by writing a "1" if a(n+1) > a(n); if not, write "0". E.g., A014577(2) = 0, since a(3) < a(2), or 1 < 2. - Gary W. Adamson, Sep 20 2003
Starting with 1 = partial sums of A034947: (1, 1, -1, 1, 1, -1, -1, 1, 1, 1, ...). - Gary W. Adamson, Jul 23 2008
The composer Per Nørgård's name is also written in the OEIS as Per Noergaard.
Can be used as a binomial transform operator: Let a(n) = the n-th term in any S(n); then extract 2^k strings, adding the terms. This results in the binomial transform of S(n). Say S(n) = 1, 3, 5, ...; then we obtain the strings: (1), (3, 1), (3, 5, 3, 1), (3, 5, 7, 5, 3, 5, 3, 1), ...; = the binomial transform of (1, 3, 5, ...) = (1, 4, 12, 32, 80, ...). Example: the 8-bit string has a sum of 32 with a distribution of (1, 3, 3, 1) or one 1, three 3's, three 5's, and one 7; as expected. - Gary W. Adamson, Jun 21 2012
Considers all positive odd numbers as nodes of a graph. Two nodes are connected if and only if the sum of the two corresponding odd numbers is a power of 2. Then a(n) is the distance between 2n + 1 and 1. - Jianing Song, Apr 20 2019

Examples

			Considered as a triangle with 2^k terms per row, the first few rows are:
  1
  2, 1
  2, 3, 2, 1
  2, 3, 4, 3, 2, 3, 2, 1
  ...
The n-th row becomes right half of next row; left half is mirrored terms of n-th row increased by one. - _Gary W. Adamson_, Jun 20 2012
		

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A037834 (-1), A088748 (+1), A246960 (mod 4), A034947 (first differences), A000975 (indices of record highs), A173318 (partial sums).
Partial sums of A112347. Recursion depth of A035327.

Programs

  • Haskell
    import Data.List (group)
    a005811 0 = 0
    a005811 n = length $ group $ a030308_row n
    a005811_list = 0 : f [1] where
       f (x:xs) = x : f (xs ++ [x + x `mod` 2, x + 1 - x `mod` 2])
    -- Reinhard Zumkeller, Feb 16 2013, Mar 07 2011
    
  • Maple
    A005811 := proc(n)
        local i, b, ans;
        if n = 0 then
            return 0 ;
        end if;
        ans := 1;
        b := convert(n, base, 2);
        for i from nops(b)-1 to 1 by -1 do
            if b[ i+1 ]<>b[ i ] then
                ans := ans+1
            fi
        od;
        return ans ;
    end proc:
    seq(A005811(i), i=1..50) ;
    # second Maple program:
    a:= n-> add(i, i=Bits[Split](Bits[Xor](n, iquo(n, 2)))):
    seq(a(n), n=0..100);  # Alois P. Heinz, Feb 01 2023
  • Mathematica
    Table[ Length[ Length/@Split[ IntegerDigits[ n, 2 ] ] ], {n, 1, 255} ]
    a[n_] := DigitCount[BitXor[n, Floor[n/2]], 2, 1]; Array[a, 100, 0] (* Amiram Eldar, Jul 11 2024 *)
  • PARI
    a(n)=sum(k=1,n,(-1)^((k/2^valuation(k,2)-1)/2))
    
  • PARI
    a(n)=if(n<1,0,a(n\2)+(a(n\2)+n)%2) \\ Benoit Cloitre, Jan 20 2014
    
  • PARI
    a(n) = hammingweight(bitxor(n, n>>1));  \\ Gheorghe Coserea, Sep 03 2015
    
  • Python
    def a(n): return bin(n^(n>>1))[2:].count("1") # Indranil Ghosh, Apr 29 2017

Formula

a(2^k + i) = a(2^k - i + 1) + 1 for k >= 0 and 0 < i <= 2^k. - Reinhard Zumkeller, Aug 14 2001
a(2n+1) = 2a(n) - a(2n) + 1, a(4n) = a(2n), a(4n+2) = 1 + a(2n+1).
a(j+1) = a(j) + (-1)^A014707(j). - Christopher Hendrie (hendrie(AT)acm.org), Sep 11 2002
G.f.: (1/(1-x)) * Sum_{k>=0} x^2^k/(1+x^2^(k+1)). - Ralf Stephan, May 02 2003
Delete the 0, make subsets of 2^n terms; and reverse the terms in each subset to generate A088696. - Gary W. Adamson, Oct 19 2003
a(0) = 0, a(2n) = a(n) + [n odd], a(2n+1) = a(n) + [n even]. - Ralf Stephan, Oct 20 2003
a(n) = Sum_{k=1..n} (-1)^((k/2^A007814(k)-1)/2) = Sum_{k=1..n} (-1)^A025480(k-1). - Ralf Stephan, Oct 29 2003
a(n) = A069010(n) + A033264(n). - Ralf Stephan, Oct 29 2003
a(0) = 0 then a(n) = a(floor(n/2)) + (a(floor(n/2)) + n) mod 2. - Benoit Cloitre, Jan 20 2014
a(n) = A037834(n) + 1.
a(n) = A000120(A003188(n)). - Amiram Eldar, Jul 11 2024

Extensions

Additional description from Wouter Meeussen

A008687 Number of 1's in 2's complement representation of -n.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

a(A127904(n)) = n and a(m) < n for m < A127904(n). - Reinhard Zumkeller, Feb 05 2007
a(n) = A000120(A010078(n)), n>0; a(n) = A023416(A004754(n-1)), n>1. - Reinhard Zumkeller, Dec 04 2015
Conjecture: a(n)+1 is the length of the Hirzebruch (negative) continued fraction for the Stern-Brocot tree fraction A007305(n)/A007306(n). - Andrey Zabolotskiy, Apr 17 2020
Terms a(n); n >= 2 can be generated recursively, as follows. Let S(0) = {1}, then for k >=1, let S(k) = {S(k-1)+1, S(k-1)}, where +1 means +1 on every term of S(k-1); see Example. Each step of the recursion gives the next 2^k terms of the sequence. - David James Sycamore, Jul 15 2024

Examples

			Using the above recursion for a(n); n >= 2, we have:
 S(0) = {1} so a(2) = 1;
 S(1) = {2,1} so a(3,4) = 2,1;
 S(2) = {3,2,2,1}, so a(5,6,7,8) = 3,2,2,1;
As irregular table the sequence for n >= 2 begins:
  1;
  2,1;
  3,2,2,1;
  4,3,3,2,3,2,2,1;
  5,4,4,3,4,3,3,2,4,3,3,2,3,2,2,1;
  6,5,5,4,5,4,4,3,5,4,3,3,4,3,3,2,5,4,4,3,4,3,3,2,4,3,3,2,3,2,2,1;
and so on (the k-th row contains 2^k terms; k>=0). - _David James Sycamore_, Jul 15 2024
		

Crossrefs

This is Guy Steele's sequence GS(4, 3) (see A135416).

Programs

  • Haskell
    a008687 n = a008687_list !! n
    a008687_list = 0 : 1 : c [1] where c (e:es) = e : c (es ++ [e+1,e])
    -- Reinhard Zumkeller, Mar 07 2011
    
  • Mathematica
    a[0] = 0; a[1] = 1; a[n_] := a[n] = Mod[n,2] + a[Mod[n,2] + Floor[n/2]]; Array[a, 96, 0] (* Jean-François Alcover, Aug 12 2017, after Reinhard Zumkeller *)
  • PARI
    a(n) = if(n<2,n, n--; logint(n,2) - hammingweight(n) + 2); \\ Kevin Ryde, Apr 14 2021

Formula

a(n) = A023416(n-1) + 1.
a(n) = if n<=1 then n else (n mod 2) + a((n mod 2) + floor(n/2)). - Reinhard Zumkeller, Feb 05 2007
a(n) = if n<2 then n else a(ceiling(n/2)) + n mod 2. - Reinhard Zumkeller, Jul 25 2006
Min{m: a(m)=n} = if n>0 then A083318(n-1) else 0. - Reinhard Zumkeller, Jul 25 2006

A147995 Array of N X N grid hopping "almost-walk", read by antidiagonals.

Original entry on oeis.org

0, 1, 3, 6, 2, 14, 5, 7, 13, 15, 26, 4, 8, 12, 58, 27, 25, 9, 11, 59, 57, 22, 24, 30, 10, 54, 56, 62, 21, 23, 29, 31, 53, 55, 61, 63, 106, 20, 18, 28, 32, 52, 50, 60, 234, 107, 105, 19, 17, 33, 35, 51, 49, 235, 233, 108, 104, 100, 16, 38, 34, 46, 48, 236, 232, 228, 111
Offset: 0

Views

Author

Roger L. Bagula and Gary W. Adamson, Nov 18 2008

Keywords

Comments

The original name was: "The sequence is an anti-diagonal of the decimal of a mapped 4-ary Gray code matrix as a triangular sequence."
Gary W. Adamson's explanation of the sequence: Here's the conversion rules for the codons, 4-Ary gray code, which "turns out" to be the most appropriate format for mapping the Codons on a gray code Karnaugh map. The "why" this is the appropriate format relates to a degree of trial and error to find the proper fit in terms of the numbers of hydrogen bonds per codon- anticodon. (Antti Karttunen's comment: obscure definition. The "degree of trial and error" should be defined transparently.)
1) The "H-bond codon-anticodon magic square" map by Gary Adamson, published on page 287 of Cliff Pickover's book "Zen of Magic Squares..." looks like this:
CCC CCU CUU CUC UUC UUU UCU UCC
CCA CCG CUG CUA UUA UUG UCG UCA
CAA CAG CGG CGA UGA UGG UAG UAA
CAC CAU CGU CGC UGC UGU UAU UAC
AAC AAU AGU AGC GGC GGU GAU GAC
AAA AAG AGG AGA GGA GGG GAG GAA
ACA ACG AUG AUA GUA GUG GCG GCA
ACC ACU AUU AUC GUC GUU GCU GCC
2) Using the conversion rules: 0 = C, 1 = A, 2 = G, 3 = U, we convert to 4-ary gray code:
000 003 033 030 330 333 303 300
001 002 032 031 331 332 302 301
011 012 022 021 321 322 312 311
010 013 023 020 320 323 313 310
110 113 123 120 220 223 213 210
111 112 122 121 221 222 212 211
101 102 132 131 231 232 202 201
100 103 133 130 230 233 203 200
3) To convert back to decimal:
0 3 14 15 58 57 62 63
1 2 13 12 59 56 61 60
6 7 8 11 54 55 50 49
5 4 9 10 53 52 51 48
26 25 30 31 32 35 46 47
27 24 29 28 33 34 45 44
22 23 18 17 38 39 40 43
21 20 19 16 37 36 41 42
... and that's it! Notice how the 1,2,3,... jumps around, somewhat like a Peano curve, from one 4-unit cell to the next.
Antti Karttunen's notes: The steps 1 & 2 are clear, but the step 3 would not produce the array given here, but instead the array A163239. Furthermore, in Pickover's book the conversion rules C=0, A=1, U=2, G=3 are used, in which case we get the array A163235. Also, the path taken by the terms does not form a continuous Peano curve (Hamiltonian path), because there are discontinuities, e.g., when going from 3 to 4, or from 15 to 16. See A163357/A163359 & A163334/A163336 for examples of continuous Peano/Hilbert curves/paths in an N X N grid. However, this sequence is uniquely defined by the formula a(n) = A163485(A057300(A054238(n))). The 8 X 8 array given at the step 3 is the top left corner of the infinite square array whose antidiagonal gives this sequence.
From Gary W. Adamson, Aug 04 2009: (Start)
This entry was originally only an e mail to the coauthor; but given that the terms are correct, the complete set of rules for the system can be presented.
Using 3 bit terms, we write out the Gray code for (0 - 7) as row headings; doing the same as the left column, then each of the 64 entries places the left column term (of 3 bits) underneath the top row headings. Then reading 2 bits from top to down in each entry, we use (0,0) = C; (1,1) = G; (0,1) = A and (1,0) = U. This gives the Gray code Karnaugh map along with 64 codons:
.
000...001...011...010...110...111...101...100
000...000...000...000...000...000...000...000
CCC...CCU...CUU...CUC...UUC...UUU...UCU...UCC
000...001...011...010...110...111...101...100
001...001...001...001...001...001...001...001
CCA...CCG...CUG...CUA...UUA...UUG...UCG...UCA
000...001...011...010...110...111...101...100
011...011...011...011...011...011...011...011
CAA...CAG...CGG...CGA...UGA...UGG...UAG...UAA
000...001...011...010...110...111...101...100
010...010...010...010...010...010...010...010
CAC...CAU...CGU...CGC...UGC...UGU...UAU...UAC
000...001...011...010...110...111...101...100
110...110...110...110...110...110...110...110
AAC...AAU...AGU...AGC...GGC...GGU...GAU...GAC
000...001...011...010...110...111...101...100
111...111...111...111...111...111...111...111
AAA...AAG...AGG...AGA...GGA...GGG...GAG...GAA
000...001...011...010...110...111...101...100
101...101...101...101...101...101...101...101
ACA...ACG...AUG...AUA...GUA...GUG...GCG...GCA
000...001...011...010...110...111...101...100
100...100...100...100...100...100...100...100
ACC...ACU...AUU...AUC...GUC...GUU...GCU...GCC
.
Next, reading again from top 3 bits to bottom, we convert the base-2 Gray code to 4-ary Gray code using the rules (0,0) = 0; (0,1) = 1; (1,1) = 2; and (1,0) = 3; giving the array given using numbers (0,1,2, and 3) = 4-ary Gray code. The previous 2 maps have the unique Gray code property of having only a 1 bit (or 1 letter) change in any direction: up, down, right, left, including wrap-arounds.
Last part of this system, we need create a linear system of Codons with only 1 bit (letter) change from one term to the next, giving an ordered decimal term for each Codon. This is done by converting the array with the (0,1,2,3) terms to the corresponding decimal term. Thus given the array: 000...003...033...030...330...333...etc; considered as 4-ary Gray code, these terms are equivalent to the array A147995 (then take antidiagonals).
Following the numbers in succession in the array (0 -> 1 -> 2 ->...63) allows for us to have a linear system of Codons with only a 1-letter change from one Codon to the next, as follows: CCC -> CCA -> CCG -> CAU...-> through 63 = UCC. The other entries as of this date in the OEIS do not have the 1-letter (only) change from one associated decimal term to the next. For example, take entry A163235: If the decimal number system (given) is superimposed upon the 64 Codon array, the term 3 corresponds to CCG, but 4 in the left column corresponds to CAC, having a 2-letter change. Similarly, take A163239: If the decimal array in that entry is superimposed on the 64 Codon array, "3" corresponds in position to CCU, but "4" corresponds to CAC; again a 2-letter change. The system given in A147995 preserves the unique 1 (bit/letter) change from one Codon to any neighbor, going in any direction; along with the corresponding linear system with a 1-letter change from one Codon to the next.
Last, we submit for each Codon the number of hydrogen bonds per codon/anti-codon using the following substitution rules: (C,G) = 3; (A,U) = 2, then add.
This gives following array which we superimpose on the Codon array, giving the correct number of Hydrogen bonds for each Codon and anti-Codon:
.
9 8 7 8 7 6 7 8
8 9 8 7 6 7 8 7
7 8 9 8 7 8 7 6
8 7 8 9 8 7 6 7
7 6 7 8 9 8 7 8
6 7 8 7 8 9 8 7
6 8 7 6 7 8 9 8
8 7 6 7 8 7 8 9
... (a semi-magic square with a binomial distribution of (1, 3, 3, 1) as to (6, 7, 8, 9) in every row and column.
Example: CUG (3rd from left, row next to top) has (C=3, U=2, G=3), total 8.
The anti-Codon of CUG = GAC and likewise has 8 hydrogen bonds. (End)
From Gary W. Adamson, Aug 04 2009: (Start)
The final outcome: superimposing the Codon map onto the decimal term map, we obtain a linear sequence of Codons with a 1-letter change between neighbors (which begs the question of how many such permutations are possible with the 1-letter change). The method of A147995 gives:
.
0 CCC; 16 AUC; 32 GGC; 48 UAC
1 CCA; 17 AUA; 33 GGA; 49 UAA
2 CCG; 18 AUG; 34 GGG; 50 UAG
3 CCU; 19 AUU; 35 GGU; 51 UAU
4 CAU; 20 ACU; 36 GUU; 52 UGU
5 CAC; 21 ACC; 37 GUC; 53 UGC
6 CAA; 22 ACA; 38 GUA; 54 UGA
7 CAG; 23 ACG; 39 GUG; 55 UGG
8 CGG; 24 AAG; 40 GCG; 56 UUG
9 CGU; 25 AAU; 41 GCU; 57 UUU
10 CGC; 26 AAC; 42 GCC; 58 UUC
11 CGA; 27 AAA; 43 GCA; 59 UUA
12 CUA; 28 AGA; 44 GAA; 60 UCA
13 CUG; 29 AGG; 45 GAG; 61 UCG
14 CUU; 30 AGU; 46 GAU; 62 UCU
15 CUC; 31 AGC; 47 GAC; 63 UCC
(End)
From Gary W. Adamson, Aug 08 2009: (Start)
The 8 X 8 array of hydrogen bonds can be derived from the 3rd row of A088696 (1, 2, 3, 2, 3, 4, 3, 2) using a simple conversion rule. Given the terms of A088696, each is replaced with its complement to 10: (1->9; 2->8; 3->7; 4->6) Note that the leftmost column going down should read: (9, 8, 7, 8, 7, 6, 7, 8) matching the top row from left to right. (End)
From Gary W. Adamson, Aug 13 2009: (Start)
Gray code -> <- Binary conversion rules: in either direction for any base; "N-Ary Gray code" -> "N-ary" or in the other direction.
.
First, N-Ary Gray code to N-Ary conversion. Write the N-Ary on a top row with the Gray code on the bottom row in both conversion variants. Given a Gray code on the bottom row, the N-Ary may be defined as "running sums MOD N" of the bottom row; then use the following rules: Leftmost term is the same.
Next, use the sum of term (n-th) in the top row from the left, and the (n+1)-th term in the bottom row, MOD N. By way of example:
Convert Gray code base 8, 3641063 to 8-ary. This gives initially,
3..................
3..6..4..1..0..6..3
.
Then (3 + 6) MOD 8 = 1 so we place a "1" above the 6 going to the right.
Then (1 + 4) MOD 8 = 5 so we place a "5" above the 5.
Continuing with this procedure, we obtain:
3 1 5 6 6 4 7 8-Ary
3 6 4 1 0 6 3 8-Ary Gray code
.
Using the 8 X 8 4-Ary chart, convert 133 (bottom row, 4th from the left) to 4-Ary then to decimal. Our setup is:
1
1 3 3
getting (1, 0, 3). Then placing powers of 4 above the 4-Ary, = 1*16 + 3 = 19 as shown in the accompanying chart, 4-Ary Gray code 133 = 19 decimal.
.
Rules for converting an N-Ary number to the corresponding N-Ary Gray code:
As before, we place the N-Ary on the top row with ongoing results on the bottom row = N-Ary Gray code.
In the top row from left to right, through through the entire number looking at pairs (n-th and (n+1)-th terms), if (n+1)-th is > than n-th, take the difference and write it down. If term (n+1) = n-th term, write down a "0".
If term (n+1) < n-th term we ADD N (as N-Ary) to (n+1)-th term then take the difference. Examples:
Find the Gray code counterpart to 2 1 base 4 = 9 decimal.
Ans.: next term (1) < (2) so we add 4 to the 1 getting 5, then take (5 - 2) = 3. So given 4-Ary 21, the corresponding Gray code term = 23
.
Find the Gray code counterpart to binary 10110 = 22 decimal. First, go through the terms writing down the difference if next term > current: (and writing "0" if next term = current term)
1, 0, 1, 1, 0
1.....1..0...
Add "2" to the terms above the vacant places and take the difference from previous term, top row:
1, 1, 1, 0, 1 final result = Gray code for 22 decimal.
.
Given 8-Ary number 3156647, base 8. Using steps (1-2) we get
3, 1, 5, 6, 6, 4, 7
3.....4..1..0.....3; then add 8 to top term for vacant places then take the difference, getting:
3..6..4..1..0..6..3; = 8-ary Gray code given 8-Ary (3 1 5 6 6 4 7).
.
Given the foregoing rules and examples, access the charts accompanying the DNA codons. 3 digit terms = 4-Ary Gray code. Convert 133 (bottom row) to 4-Ary then to decimal. We get:
1
1 0 3 = (16 + 0 + 3) = 19
Convert 39 decimal to 4-Ary then to 4-Ary Gray code. 39 = 213 4-Ary = (2*16 + 4 + 3); then
2 1 3
2...2; then add "4" to the 1 and take the difference = (5 - 2) = 3. = 2 3 2 = 4-Ary Gray code for decimal 39 as shown in the dual charts, next to bottom row, third from the right: (232 corresponds to 39) in the accompanying chart.
Properties of Gray code: sum of terms MOD N = decimal MOD N. Example: 232 corresponds to 19, then (2 + 3 + 2) MOD 4 = 3, and 19 == 3 MOD 4.
Another property: Highest exponent of N dividing a decimal term.
Access term (n-1) writing the Gray code on the top row and Gray code for n-th term on the bottom. Determine column change = (0, 1, 2, ...) starting from the right. Let the column = c. then c is the highest exponent of N dividing n-th term. Examples: 40 in 4-Ary Gray code = 202, while 41 = 203. Change is in column 0 so 203 can be divided by 4^0. But 44 in 4-Ary Gray code = 211 while 43 = 201. Bit change is in column 1 so 4^1 divides 44. (End)

Examples

			Antidiagonals begin:
  { 0},
  { 1,  3},
  { 6,  2, 14},
  { 5,  7, 13, 15},
  {26,  4,  8, 12, 58},
  {27, 25,  9, 11, 59, 57},
  {22, 24, 30, 10, 54, 56, 62},
  {21, 23, 29, 31, 53, 55, 61, 63}
		

References

  • Clifford A. Pickover, The Zen of Magic Squares, Circles, and Stars: An Exhibition of Surprising Structures across Dimensions, Princeton University Press, 2002, pp. 285-289.

Crossrefs

a(n) = A163545(A061579(n)), i.e., transpose of A163545. Antidiagonal sums: A163484. Inverse: A163544. See also A163233, A163235, A163237, A163239, A163357, A163359.
Cf. A088696. - Gary W. Adamson, Aug 08 2009

Programs

  • Mathematica
    M = {{0, 3, 14, 15, 58, 57, 62, 63}, {1, 2, 13, 12, 59, 56, 61, 60}, {6, 7, 8, 11, 54, 55, 50, 49}, {5, 4, 9, 10, 53, 52, 51, 48}, {26, 25, 30, 31, 32, 35, 46, 47}, {27, 24, 29, 28, 33, 34, 45, 44}, {22, 23, 18, 17, 38, 39, 40, 43}, {21, 20, 19, 16, 37, 36, 41, 42}}; Table[Table[M[[n - m + 1, m]], {m, 1, n}], {n, 1, Length[M]}]; Flatten[%]

Formula

M = {{0, 3, 14, 15, 58, 57, 62, 63}, {1, 2, 13, 12, 59, 56, 61, 60}, {6, 7, 8, 11, 54, 55, 50, 49}, {5, 4, 9, 10, 53, 52, 51, 48}, {26, 25, 30, 31, 32, 35, 46, 47}, {27, 24, 29, 28, 33, 34, 45, 44}, {22, 23, 18, 17, 38, 39, 40, 43}, {21, 20, 19, 16, 37, 36, 41, 42}}; t(n,m) = antidiagonal(M).
a(n) = A163485(A057300(A054238(n))). - Antti Karttunen, Aug 01 2009

Extensions

Edited, extended, keywords tabl and obsc added and offset changed from 1 to 0 by Antti Karttunen, Aug 01 2009

A088748 a(n) = 1 + Sum_{k=0..n-1} 2 * A014577(k) - 1.

Original entry on oeis.org

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

Views

Author

Gary W. Adamson, Oct 14 2003

Keywords

Comments

Let s(0)=1; s(n+1)=s(n),ri(n), where ri(n) is s(n) reversed and incremented. Each s(n) is an initial part of this sequence.
For each m, a(1 to 2^m) is a permutation of A063787(1 to 2^m). For k=1 to 2^m, a(2^m+1-A088372(m,k)) = A063787(k).
Partial sums give A164910: (1, 3, 6, 8, 11, 15, 20, ...).
a(0) = 1, then using the dragon curve sequence A014577: (1, 1, 0, 1, 1, ...) as a code: (1 = add to current term, 0 = subtract from current term, to get the next term), see example.
Rows of A088696 tend to this sequence.

Examples

			The first 8 terms of the sequence = (1, 2, 3, 2, 3, 4, 3, 2), where the first four terms = (1, 2, 3, 2). Reverse, add 1, getting (3, 4, 3, 2), then append.
The sequence begins with "1", then using the dragon curve coding, we get:
1...2...3...2...3...4... = A088748
....1...1...0...1...1... = A014577, the dragon curve.
		

Crossrefs

Programs

  • Mathematica
    Array[1 + Sum[2 (1 - (((Mod[#1, 2^(#2 + 2)]/2^#2)) - 1)/2) - 1 &[k, IntegerExponent[k, 2]], {k, # - 1}] &, 102] (* Michael De Vlieger, Aug 26 2020 *)

Formula

a(n) = 1 + A005811(n). [Joerg Arndt, Dec 11 2012]

Extensions

Edited by Don Reble, Nov 15 2005
Additional comments from Gary W. Adamson, Aug 30 2009
Edited by N. J. A. Sloane, Sep 06 2009

A164281 Triangle read by rows, a Petoukhov sequence (cf. A164279) generated from (1,2).

Original entry on oeis.org

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

Views

Author

Gary W. Adamson, Aug 12 2009

Keywords

Comments

Row sums = powers of 3: (1, 3, 9, 27, 81, ...). A164279 = a Petoukhov sequence generated through analogous principles from (3,2), with row sums = powers of 5.
Essentially, A164281 converts the terms (1,2,4,8,...) into rows with a binomial distribution as to frequency of terms. For example, row 3 has one 1, three 2's, three 4's, and one 8. This property arises due to the origin of the system of codes in A164056 (derived from the Gray code).
A Gray code origin also preserves the "one bit" (in this case, a "one product operation") since in each row, the next term is either twice current term or (1/2) current term.
Rows tend to A166242. - Gary W. Adamson, Oct 10 2009

Examples

			First few rows of the triangle =
  1;
  1, 2;
  1, 2, 4, 2;
  1, 2, 4, 2, 4, 8, 4, 2;
  1, 2, 4, 2, 4, 8, 4, 2, 4, 8, 16, 8, 4, 8, 4, 2;
  ...
Example: row 3 of A164056 = (0, 1, 1, 0, 1, 1, 0, 0), so beginning with "1" at left, row 3 of A164281 = (1, 2, 4, 2, 4, 8, 4, 2).
		

References

  • Sergei Petoukhov & Matthew He, "Symmetrical Analysis Techniques for Genetic Systems and Bioinformatics - Advanced Patterns and Applications", IGI Global, 978-1-60566-127-9, October 2009, Chapters 2, 4, and 6.

Crossrefs

Programs

Formula

Given row terms of triangle A059268: (1; 1,2; 1,2,4; 1,2,4,8;...) and the digital codes in A164056: (0; 0,1; 0,1,1,0; 0,1,1,0,1,1,0,0;...); beginning with "1" in each row, multiply by 2 to obtain the next term to the right, if the corresponding positional term in A164056 = "1". Divide by 2 if the corresponding A164056 term = 0.
A(n, k) = 2^(A088696(n+1, k)-1). - Andrey Zabolotskiy, Feb 18 2025

Extensions

Corrected and more terms from Jon Maiga, Oct 04 2019

A164738 Triangle read by rows. Row 0 = {2}; left half of row n+1 = row n, right half = row n reversed with each term replaced by the next prime.

Original entry on oeis.org

2, 2, 3, 2, 3, 5, 3, 2, 3, 5, 3, 5, 7, 5, 3, 2, 3, 5, 3, 5, 7, 5, 3, 5, 7, 11, 7, 5, 7, 5, 3, 2, 3, 5, 3, 5, 7, 5, 3, 5, 7, 11, 7, 5, 7, 5, 3, 5, 7, 11, 7, 11, 13, 11, 7, 5, 7, 11, 7, 5, 7, 5, 3, 2, 3, 5, 3, 5, 7, 5, 3, 5, 7, 11, 7, 5, 7, 5, 3, 5, 7, 11, 7, 11, 13, 11, 7, 5, 7, 11, 7, 5, 7, 5, 3, 5, 7, 11, 7
Offset: 0

Views

Author

Gary W. Adamson, Aug 23 2009

Keywords

Comments

Row n has 2^n terms.
Row sums = (2, 5, 13, 33, 83, 205, 495,...) = A007443, the binomial transform of the primes.

Examples

			The triangle begins:
  2;
  2, 3;
  2, 3, 5, 3;
  2, 3, 5, 3, 5, 7, 5, 3;
  2, 3, 5, 3, 5, 7, 5, 3, 5, 7, 11, 7, 5, 7, 5, 3;
  ...
		

Crossrefs

Programs

  • Mathematica
    Flatten[NestList[Join[ #, NextPrime[Reverse[ # ]]] &, {2}, 7]] (* Zak Seidov, Aug 24 2009 *)

Extensions

More terms from Zak Seidov, Aug 24 2009
Edited by Zak Seidov and N. J. A. Sloane, Aug 25 2009
Offset 0 from Alois P. Heinz, Oct 31 2023
Showing 1-7 of 7 results.