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

A099545 Odd part of n, modulo 4.

Original entry on oeis.org

1, 1, 3, 1, 1, 3, 3, 1, 1, 1, 3, 3, 1, 3, 3, 1, 1, 1, 3, 1, 1, 3, 3, 3, 1, 1, 3, 3, 1, 3, 3, 1, 1, 1, 3, 1, 1, 3, 3, 1, 1, 1, 3, 3, 1, 3, 3, 3, 1, 1, 3, 1, 1, 3, 3, 3, 1, 1, 3, 3, 1, 3, 3, 1, 1, 1, 3, 1, 1, 3, 3, 1, 1, 1, 3, 3, 1, 3, 3, 1, 1, 1, 3, 1, 1, 3, 3, 3, 1, 1, 3, 3, 1, 3, 3, 3, 1, 1, 3, 1, 1, 3
Offset: 1

Views

Author

Ralf Stephan, Oct 23 2004

Keywords

Comments

The terms of this sequence are the even-indexed terms of A112658. - Alexandre Wajnberg, Jan 02 2006
Fractal sequence: odd terms are 1, 3, 1, 3,...; the even terms are the sequence itself: a(n)=a(2n)=a(4n)=a(8n)=a(16n)=... - Alexandre Wajnberg, Jan 02 2006
From Micah D. Tillman, Jan 29 2021: (Start)
Has the same structure as the regular paper-folding (dragon curve) sequence (A014577, A014709). We can interpret a(n) as the number of 90-degree rotations to make in a single direction at the n-th "turn" in the dragon curve. After all, making three 90-degree rotations to the left (turning a total of 270 degrees) is equivalent to making one 90-degree rotation to the right, and vice versa.
We can likewise produce the dragon curve by interpreting A000265(n), the whole odd part of n, as the number of 90-degree rotations to make in a single direction at the n-th "turn" in the curve. (End)

Examples

			a(100) = 1: the odd part of 100 is 100/4 = 25, and 25 mod 4 = 1.
		

Crossrefs

Programs

  • Mathematica
    Array[Mod[#/(2^IntegerExponent[#, 2]), 4] &, 105] (* Michael De Vlieger, Feb 24 2021 *)
  • PARI
    a(n)=bitand(n/(2^valuation(n,2)), 3); /* Joerg Arndt, Jul 18 2012 */
    
  • Python
    def A099545(n): return n>>(~n&n-1).bit_length()&3 # Chai Wah Wu, Feb 26 2025

Formula

a(n) = 2 * A038189(n) + 1.
(a(n)-1)/2 = A014707(n). - Alexandre Wajnberg, Jan 02 2006
a(n) = A010873(A000265(n)).
Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = 2. - Amiram Eldar, Aug 29 2024

A122002 a(0)=5; otherwise a(n) = (n mod 4) if n is odd, a(n) = h + 4, where h = (highest odd divisor of n) mod 4 if n is even.

Original entry on oeis.org

5, 1, 5, 3, 5, 1, 7, 3, 5, 1, 5, 3, 7, 1, 7, 3, 5, 1, 5, 3, 5, 1, 7, 3, 7, 1, 5, 3, 7, 1, 7, 3, 5, 1, 5, 3, 5, 1, 7, 3, 5, 1, 5, 3, 7, 1, 7, 3, 7, 1, 5, 3, 5, 1, 7, 3, 7, 1, 5, 3, 7, 1, 7, 3, 5, 1, 5, 3, 5, 1, 7, 3, 5, 1, 5, 3, 7, 1, 7, 3, 5, 1, 5, 3, 5, 1, 7, 3, 7, 1, 5, 3, 7, 1, 7, 3, 7, 1, 5, 3, 5
Offset: 0

Views

Author

N. J. A. Sloane, Aug 05 2008

Keywords

Comments

a(n) in {1,3,5,7} for all n. a(4k+i) = i if i is odd.
There is a typo in Grytczuk's definition: he has "+ 5" instead of "+ 4".

Crossrefs

Essentially the same: A112658 (map 1357 -> 0213), A125047 (map 1357 -> 2314).
Cf. A003324.

Programs

  • Mathematica
    a[0]=5;a[n_]:=If[OddQ[n],Mod[n,4],4+Mod[Select[Divisors[n],OddQ][[-1]],4]];Table[a[n],{n,0,100}] (* James C. McMahon, Oct 25 2024 *)
  • PARI
    a(n) = 2*if(n,bittest(n,valuation(n,2)+1)) + if(n%2,1,5); \\ Kevin Ryde, Sep 09 2020

Formula

Morphism 1 -> 5,3; 3 -> 7,3; 5 -> 5,1; 7 -> 7,1 starting from 5 [Carpi, h in remark after lemma 3.2]. - Kevin Ryde, Sep 09 2020

Extensions

Terms from a(26) on from John W. Layman, Aug 27 2008

A125047 Infinite word generated by mapping 1->12, 2->13, 3->43, 4->42 starting at 1.

Original entry on oeis.org

1, 2, 1, 3, 1, 2, 4, 3, 1, 2, 1, 3, 4, 2, 4, 3, 1, 2, 1, 3, 1, 2, 4, 3, 4, 2, 1, 3, 4, 2, 4, 3, 1, 2, 1, 3, 1, 2, 4, 3, 1, 2, 1, 3, 4, 2, 4, 3, 4, 2, 1, 3, 1, 2, 4, 3, 4, 2, 1, 3, 4, 2, 4, 3, 1, 2, 1, 3, 1, 2, 4, 3, 1, 2, 1, 3, 4, 2, 4, 3, 1, 2, 1, 3, 1, 2, 4, 3, 4, 2, 1, 3, 4, 2, 4, 3, 4, 2, 1, 3, 1, 2, 4, 3, 1
Offset: 1

Views

Author

Michael Somos, Nov 17 2006

Keywords

Comments

Infinite word over 4-letter alphabet that contains no squares in arithmetic progressions of odd difference. - Ralf Stephan, May 09 2007

Examples

			1 -> 12 -> 1213 -> 12131242 -> 1213124312134243 -> ...
		

Crossrefs

Essentially the same: A112658 (map 1234 -> 1023), A122002 (map 1234 -> 5137).
Cf. A038190.

Programs

  • Mathematica
    SubstitutionSystem[{1 -> {1, 2}, 2 -> {1, 3}, 3 -> {4, 3}, 4 -> {4, 2}}, {1}, 7] // Last (* Jean-François Alcover, Dec 17 2018 *)
  • PARI
    {a(n)=local(A); if(n<1, 0, A=[1]; while(length(A)
    				
  • PARI
    my(table=[1,2;4,3]); a(n) = n--; table[if(n,bittest(n,1+valuation(n,2)))+1, n%2+1]; \\ Kevin Ryde, Sep 05 2020

Formula

Recurrence: a(1)=1, a(4n)=3, a(4n+2)=2, a(8n+3)=1, a(8n+7)=4, a(4n+1)=a(2n+1). - Ralf Stephan, May 09 2007

A343421 Number of Dean words of length n, i.e., squarefree reduced words over {0,1,2,3}.

Original entry on oeis.org

4, 8, 16, 24, 40, 64, 104, 144, 216, 328, 496, 720, 1072, 1584, 2344, 3384, 4952, 7264, 10632, 15504, 22656, 33136, 48488, 70592, 103032, 150352, 219400, 319816, 466664, 680872, 993440, 1447952, 2111448, 3079464, 4491216, 6548936, 9550728, 13927840, 20311168
Offset: 1

Views

Author

Michel Marcus, Apr 15 2021

Keywords

Comments

A Dean word is a reduced word that does not contain occurrences of ww for any nonempty w.
a(n) is a multiple of 4 by symmetry. - Michael S. Branicky, Jun 20 2022

Crossrefs

Programs

  • Python
    def isf(s): # incrementally squarefree (check factors ending in last letter)
        for l in range(1, len(s)//2 + 1):
            if s[-2*l:-l] == s[-l:]: return False
        return True
    def aupton(nn, verbose=False):
        alst, sfs = [], set("0")
        for n in range(1, nn+1):
            an, eo = 4*len(sfs), ["02", "13"]
            sfsnew = set(s+i for s in sfs for i in eo[n%2] if isf(s+i))
            alst, sfs = alst+[an], sfsnew
            if verbose: print(n, an)
        return alst
    print(aupton(30)) # Michael S. Branicky, Jun 20 2022

Extensions

More terms from James Rayman, Apr 15 2021

A343180 Trajectory of 1 under the morphism 1 -> 12, 2 -> 32, 3 -> 14, 4 -> 34.

Original entry on oeis.org

1, 2, 3, 2, 1, 4, 3, 2, 1, 2, 3, 4, 1, 4, 3, 2, 1, 2, 3, 2, 1, 4, 3, 4, 1, 2, 3, 4, 1, 4, 3, 2, 1, 2, 3, 2, 1, 4, 3, 2, 1, 2, 3, 4, 1, 4, 3, 4, 1, 2, 3, 2, 1, 4, 3, 4, 1, 2, 3, 4, 1, 4, 3, 2, 1, 2, 3, 2, 1, 4, 3, 2, 1, 2, 3, 4, 1, 4, 3, 2, 1, 2, 3, 2, 1, 4, 3, 4, 1, 2, 3, 4, 1, 4, 3
Offset: 0

Views

Author

N. J. A. Sloane, May 02 2021

Keywords

Crossrefs

A112658 is another version of the same sequence.

Programs

  • Maple
    f(1):= (1,2): f(2):= (3,2): f(3) := (1,4); f(4) := (3,4);  #
    A:= [1]:
    for i from 1 to 8 do A:= map(f, A) od:
    A;
Showing 1-5 of 5 results.