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

A060236 If n mod 3 = 0 then a(n) = a(n/3), otherwise a(n) = n mod 3.

Original entry on oeis.org

1, 2, 1, 1, 2, 2, 1, 2, 1, 1, 2, 1, 1, 2, 2, 1, 2, 2, 1, 2, 1, 1, 2, 2, 1, 2, 1, 1, 2, 1, 1, 2, 2, 1, 2, 1, 1, 2, 1, 1, 2, 2, 1, 2, 2, 1, 2, 1, 1, 2, 2, 1, 2, 2, 1, 2, 1, 1, 2, 2, 1, 2, 1, 1, 2, 1, 1, 2, 2, 1, 2, 2, 1, 2, 1, 1, 2, 2, 1, 2, 1, 1, 2, 1, 1, 2, 2, 1, 2, 1, 1, 2, 1, 1, 2, 2, 1, 2, 2, 1, 2, 1, 1, 2, 2
Offset: 1

Views

Author

Henry Bottomley, Mar 21 2001

Keywords

Comments

A cubefree word. Start with 1, apply the morphisms 1 -> 121, 2 -> 122, take limit. See A080846 for another version.
Ultimate modulo 3: n-th digit of terms in "Ana sequence" (see A060032 for definition).
Equals A005148(n) reduced mod 3. In "On a sequence Arising in Series for Pi" Morris Newman and Daniel Shanks conjectured that 3 never divides A005148(n) and D. Zagier proved it. - Benoit Cloitre, Jun 22 2002
Also equals A038502(n) mod 3.
Last nonzero digit in ternary representation of n. - Franklin T. Adams-Watters, Apr 01 2006
a(2*n) = length of n-th run of twos. - Reinhard Zumkeller, Mar 13 2015

Examples

			a(10)=1 since 10=3^0*10 and 10 mod 3=1;
a(72)=2 since 24=3^3*8 and 8 mod 3=2.
		

Crossrefs

Cf. A026225 (indices of 1's), A026179 (indices of 2's).
Cf. A060032 (concatenate 3^n terms).

Programs

  • Haskell
    following Franklin T. Adams-Watters's comment.
    a060236 = head . dropWhile (== 0) . a030341_row
    -- Reinhard Zumkeller, Mar 13 2015
    
  • Magma
    [(Floor(n/3^Valuation(n, 3)) mod 3): n in [1..120]]; // G. C. Greubel, Nov 05 2024
    
  • Mathematica
    Nest[ Flatten[ # /. {1 -> {1, 2, 1}, 2 -> {1, 2, 2}}] &, {1}, 5] (* Robert G. Wilson v, Mar 04 2005 *)
    Table[Mod[n/3^IntegerExponent[n, 3], 3], {n, 1, 120}] (* Clark Kimberling, Oct 19 2016 *)
    lnzd[m_]:=Module[{s=Split[m]},If[FreeQ[Last[s],0],s[[-1,1]],s[[-2,1]]]]; lnzd/@Table[IntegerDigits[n,3],{n,120}] (* Harvey P. Dale, Oct 19 2018 *)
  • PARI
    a(n)=if(n<1, 0, n/3^valuation(n,3)%3) /* Michael Somos, Nov 10 2005 */
    
  • SageMath
    [n/3^valuation(n, 3)%3 for n in range(1,121)] # G. C. Greubel, Nov 05 2024

Formula

a(3*n) = a(n), a(3*n + 1) = 1, a(3*n + 2) = 2. - Michael Somos, Jul 29 2009
a(n) = 1 + A080846(n). - Joerg Arndt, Jan 21 2013

A337580 a(n) is the sequence of turns in the n-th iteration of the dragon curve encoded in binary (L=1, R=0) represented in decimal.

Original entry on oeis.org

1, 6, 108, 27876, 1826942052, 7846656369001524324, 144745261873314177475604083946266324068, 49254260310842419635956203183145610297351659359183114324190902443509341776996
Offset: 1

Views

Author

Michal D. Kuczynski, Sep 01 2020

Keywords

Comments

The first iterations of the dragon curve produce the following sequence of turns:
1st iteration: L
2nd iteration: L L R
3rd iteration: L L R L L R R
4th iteration: L L R L L R R L L L R R L R R
Substituting L=1 and R=0 one obtains the sequence (1, 110, 1101100, ...). Finally the entries are interpreted as binary numbers. In decimal the result is: (1, 6, 108, ...).

Examples

			Recurrence:
a(0) = 1.
a(1) = 1|1|rev(not(1)) = 110.
a(2) = 110|1|rev(not(110)) = 1101|rev(001) = 1101100.
n-th digit:
d(1) = -(1/2)*(1 mod 4) + 3/2 = 1.
d(2) = -(1/2)*(1 mod 4) + 3/2 = 1 (since 2=2*1).
d(3) = -(1/2)*(3 mod 4) + 3/2 = 0.
Explicit formula:
a(3) = d(1)*2^6 + d(2)*2^5 + d(3)*2^4 + 2^3 + (1-d(3))*2^2 + (1-d(2))*2^1 + (1-d(1))*2^0 = 2^6 + 2^5 + 2^3 + 2^2 = 108.
		

Crossrefs

Cf. A060032 (terdragon turns in digits).

Programs

  • Mathematica
    a[1] = 1; a[n_] := a[n] = FromDigits[Join[(d = IntegerDigits[a[n - 1], 2]), {1}, 1 - Reverse[d]], 2]; Array[a, 8] (* Amiram Eldar, Sep 03 2020 *)
  • Python
    a=[]
    a.append('1')
    def bnot(string):
        nstring=''
        for letter in string:
            nstring+=str(-int(letter)+1)
        return nstring
    for i in range(10):
        a.append(a[i]+'1'+bnot(a[i])[::-1])
    print([int(i,2) for i in a])

Formula

Recursive, in base 2:
a(0) = 1; a(n) = a(n-1)|1|rev(not(a(n-1))), where | denotes concatenation, not() denotes binary not, and rev() denotes order reverse (e.g., rev(110) = 011).
Continuing (in base 2):
The n-th digit, d(n), of any element is given by A014577. The following algorithm can also be used:
Express n in the form k2^m with k odd.
d(n) = -1/2 mod(k,4) + 3/2
Explicit formula: the n-th element in the sequence is given by (in base 10):
a(n) = d(1)*2^(2^n-2) + d(2)*2^(2^n-3) + d(3)*2^(2*n-4) + ... + 2^n + ... + (1-d(3))*2^2 + (1-d(2))*2^1 + (1-d(1))*2^0.
Asymptotic growth:
a(n) ~ 2^(2^n-2).
a(n)/2^(2^n-1) ~ A143347 (paper-folding constant).

A061456 Binary representation of a(n) corresponds to "ana"-sequence.

Original entry on oeis.org

1, 5, 357, 93768037, 1689174798555184371255653, 9874926935306000254499942419184958425482775497556872534778412080951642469
Offset: 1

Views

Author

Frank Ellermann, Jun 11 2001

Keywords

Comments

Encoding 'ana'/'121' = 1 and 'ann'/'122' = 2 results again in A060032 (left shifted).

Examples

			a(3)= 357= 256+64+32+4+1= '101,100,101' (base 2), A060032(3)= '121,122,121'.
		

Crossrefs

A068490 Fixed point of the morphism 1 -> 121, 2 -> 12, starting from 1.

Original entry on oeis.org

1, 121, 12112121, 121121211211212112121, 1211212112112121121211211212112112121121211211212112121, 121121211211212112121121121211211212112121121121211212112112121121121211212112112121121121211212112112121121211211212112112121121211211212112121
Offset: 1

Views

Author

Joseph L. Pe, Mar 11 2002

Keywords

Comments

Previous name was: In the Ana sequence, use (the ungrammatical) "a n" instead of "an n" in describing n's. That is, begin with the letter "a". Generate the next term by using the indefinite article as appropriate, but using "a n" instead of "an n". E.g., "an a", then "an a, a n, an a" etc. Assign a=1, n=2.
For proofs of the following assertions, see the link to the paper "Ana's Golden Fractal". Let A(n), N(n) denote the number of 1's and the number of 2's in a(n). Then for n > 1, A(n), N(n) are consecutive Fibonacci numbers: A(n) = F(2n-1), N(n) = F(2n-2), where F(k) denotes the k-th Fibonacci number. Hence lim_{n} A(n)/N(n) = phi, the golden ratio.
In "Wonders of Numbers", Pickover considers a "fractal bar code" constructed from the Ana sequence. Start with a segment I of fixed length; at stage n, evenly subdivide I into as many non-overlapping closed intervals as there are letters in the n-th term of the Ana sequence; then shade the intervals corresponding to a's. It can be shown that a fractal set defined from this construction using the golden Ana sequence has fractal dimension = 1.
Fixed point of the morphism 1 -> 121, 2 -> 12, starting from a(1) = 1. See A003842.

References

  • C. Pickover, Wonders of Numbers, Chap. 69 "An A?", Oxford University Press, NY, 2001, pp. 167-171.

Crossrefs

Cf. A060032.

Programs

  • Mathematica
    f[n_] := FromDigits[ Nest[ Flatten[ # /. {1 -> {1, 2, 1}, 2 -> {1, 2}}] &, {1}, n]]; Table[ f[n], {n, 0, 5}] (* Robert G. Wilson v, Mar 05 2005 *)

Extensions

More concise name from comment, Joerg Arndt, Jan 23 2024
Showing 1-4 of 4 results.