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.

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))