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

A355478 The honeybee prime walk: a(n) is the number of closed honeycomb cells after the n-th step of the walk described in the comments.

Original entry on oeis.org

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, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9
Offset: 0

Views

Author

Paolo Xausa, Jul 18 2022

Keywords

Comments

At step 0, the honeybee is at the origin. No honeycomb cell wall is yet built.
At step 1, the honeybee walks one unit eastward, building the first cell wall.
At step n, the honeybee turns 60 degrees clockwise or counterclockwise (depending on whether n is prime or not, respectively), then walks one unit in the new direction, building the next cell wall (which may coincide with an existing wall).
a(n) is the number of distinct, "unit" honeycomb cells (six sides of unit length) built after the n-th step.
Does this walk generate a full hexagonal tiling of the plane?

Examples

			In the following diagrams the walk is shown at the end of the n-th step, together with the position of the bee (*).
.
n     0      1      8        28               60
a(n)  0      0      0         1                5
                                         __
                                      __/ 5\*_
      *      __*   __    __          / 4\__/  \__
                     \     \__       \__/ 3\__   \__
                     /     /  \__       \__/ 2\__/  \__
                     \     \*_   \__       \__/  \__   \__
                     /     / 1\     \            / 1\     \
                     \     \__/   __/            \__/   __/
                     /     /   __/               /   __/
                     \*    \__/                  \__/
.
		

Crossrefs

Programs

  • Mathematica
    A355478[nmax_]:=Module[{a={0}, walk={{0, 0}}, angle=0, cells}, Do[AppendTo[walk, AngleVector[Last[walk], angle+=If[PrimeQ[n], -1, 1]Pi/3]]; cells=FindCycle[Graph[MapApply[UndirectedEdge, Partition[walk, 2, 1]]], {6}, All]; AppendTo[a, CountDistinct[Map[Sort, Map[First, cells, {2}]]]], {n, nmax}]; a];
    A355478[100] (* Paolo Xausa, Jan 04 2023 *)

A357434 a(n) is the number of distinct Q-toothpicks after the n-th stage of the structure described in A211000.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 17, 18, 18, 18, 18, 19, 20, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 24, 25, 26, 27, 28, 28
Offset: 0

Views

Author

Paolo Xausa, Sep 28 2022

Keywords

Comments

See A211000 for additional information.
For the definition of Q-toothpicks, see A187210.

Examples

			In the following diagrams the A211000 structure is shown at the end of the n-th stage (Q-toothpicks are depicted as straight lines instead of circle arcs).
.
n       0       1      10      15      32      39      60      65
a(n)    0       1      10      15      16      20      23      28
.
                                                                /\
                                                                \/
                                                                 \
                                                         /       /
                                                /       /\      /\
                                                \       \/      \/
              /       /\      /\      /\      /\/\    /\/\    /\/\
                        \       \       \/      \/      \/      \/
                         \      /\      /\      /\      /\      /\
                         /      \/      \/      \/      \/      \/
                        /       /\      /\      /\      /\      /\
                        \       \/      \/      \/      \/      \/
                         \      /\      /\      /\      /\      /\
                        \/      \/      \/      \/      \/      \/
.
		

Crossrefs

Programs

  • Mathematica
    A357434[nmax_]:=Module[{a={0},tp={},ep1={0,0},ep2,angle=0,turn=Pi/2},Do[If[!PrimeQ[n],If[n>5&&PrimeQ[n-1],turn*=-1];angle-=turn];tp=Union[tp,{{ep1,ep2=AngleVector[ep1,angle]}}];ep1=ep2;AppendTo[a,Length[tp]],{n,0,nmax-1}];a];
    A357434[100]
  • PARI
    A357434(nmax) = my(a=List([0,1]), newtp=[[0, 0], [1, 1]], tp=Set([newtp]), turn=1, p1, p2); if(nmax==0, return([0]));for(n=1, nmax-1, p1=newtp[1]; p2=newtp[2]; if(isprime(n), newtp=[p2, [2*p2[1]-p1[1], 2*p2[2]-p1[2]]], if(n>5 && isprime(n-1), turn*=-1); newtp=[p2, [p2[1]-turn*(p1[2]-p2[2]), p2[2]+turn*(p1[1]-p2[1])]]); tp=setunion(tp, [newtp]); listput(a,length(tp))); Vec(a);
    A357434(100)
    
  • Python
    from sympy import isprime
    def A357434(nmax):
        newtp, a, turn = ((0, 0), (1, 1)), [0, 1], 1
        tp = {newtp}
        for n in range(1, nmax):
            p1, p2 = newtp[0], newtp[1]
            if isprime(n): # Continue straight
                newtp = (p2, (2*p2[0]-p1[0], 2*p2[1]-p1[1]))
            else:          # Turn
                if n>5 and isprime(n-1): turn *= -1
                newtp = (p2, (p2[0]-turn*(p1[1]-p2[1]), p2[1]+turn*(p1[0]-p2[0])))
            tp.add(newtp)
            a.append(len(tp))
        return a[:nmax+1]
    print(A357434(100))

A355480 a(n) is the number of distinct, hexagonal-tiled regions after the n-th step of the walk described in A355478.

Original entry on oeis.org

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, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3
Offset: 0

Views

Author

Paolo Xausa, Jul 21 2022

Keywords

Comments

See A355478 for additional information and animations.

Examples

			In the following diagrams the walk is shown at the end of the n-th step, together with the position of the bee (*).
.
n     0      1      8        28               60
a(n)  0      0      0         1                2
                                         __
                                      __/ 2\*_
      *      __*   __    __          / 2\__/  \__
                     \     \__       \__/ 2\__   \__
                     /     /  \__       \__/ 2\__/  \__
                     \     \*_   \__       \__/  \__   \__
                     /     / 1\     \            / 1\     \
                     \     \__/   __/            \__/   __/
                     /     /   __/               /   __/
                     \*    \__/                  \__/
.
		

Crossrefs

Programs

  • Mathematica
    A355480[nterms_]:=Module[{a={0},walk={{0,0}},angle=0,cells},Do[AppendTo[walk,AngleVector[Last[walk],angle+=If[PrimeQ[n],-1,1]Pi/3]];cells=FindCycle[Graph[MapApply[UndirectedEdge,Partition[walk,2,1]]],{6},All];AppendTo[a,Length[ConnectedComponents[Graph[Flatten[cells]]]]],{n,nterms-1}];Take[a,nterms]];
    A355480[100]
Showing 1-3 of 3 results.