OFFSET
0,3
LINKS
EXAMPLE
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
.
/\
\/
\
/ /
/ /\ /\
\ \/ \/
/ /\ /\ /\ /\/\ /\/\ /\/\
\ \ \/ \/ \/ \/
\ /\ /\ /\ /\ /\
/ \/ \/ \/ \/ \/
/ /\ /\ /\ /\ /\
\ \/ \/ \/ \/ \/
\ /\ /\ /\ /\ /\
\/ \/ \/ \/ \/ \/
.
MATHEMATICA
PROG
(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))
CROSSREFS
KEYWORD
nonn
AUTHOR
Paolo Xausa, Sep 28 2022
STATUS
approved