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.
%I A357434 #24 Oct 01 2022 21:15:07 %S A357434 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, %T A357434 15,15,15,15,15,15,16,17,18,18,18,18,19,20,21,22,22,22,22,22,22,22,22, %U A357434 22,22,22,22,22,22,22,22,22,22,22,23,24,25,26,27,28,28 %N A357434 a(n) is the number of distinct Q-toothpicks after the n-th stage of the structure described in A211000. %C A357434 See A211000 for additional information. %C A357434 For the definition of Q-toothpicks, see A187210. %H A357434 N. J. A. Sloane, <a href="/wiki/Catalog_of_Toothpick_and_CA_Sequences_in_OEIS">Catalog of Toothpick and Cellular Automata Sequences in the OEIS</a> %H A357434 <a href="/index/To#toothpick">Index entries for sequences related to toothpick sequences</a> %e A357434 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). %e A357434 . %e A357434 n 0 1 10 15 32 39 60 65 %e A357434 a(n) 0 1 10 15 16 20 23 28 %e A357434 . %e A357434 /\ %e A357434 \/ %e A357434 \ %e A357434 / / %e A357434 / /\ /\ %e A357434 \ \/ \/ %e A357434 / /\ /\ /\ /\/\ /\/\ /\/\ %e A357434 \ \ \/ \/ \/ \/ %e A357434 \ /\ /\ /\ /\ /\ %e A357434 / \/ \/ \/ \/ \/ %e A357434 / /\ /\ /\ /\ /\ %e A357434 \ \/ \/ \/ \/ \/ %e A357434 \ /\ /\ /\ /\ /\ %e A357434 \/ \/ \/ \/ \/ \/ %e A357434 . %t A357434 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]; %t A357434 A357434[100] %o A357434 (PARI) %o A357434 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); %o A357434 A357434(100) %o A357434 (Python) %o A357434 from sympy import isprime %o A357434 def A357434(nmax): %o A357434 newtp, a, turn = ((0, 0), (1, 1)), [0, 1], 1 %o A357434 tp = {newtp} %o A357434 for n in range(1, nmax): %o A357434 p1, p2 = newtp[0], newtp[1] %o A357434 if isprime(n): # Continue straight %o A357434 newtp = (p2, (2*p2[0]-p1[0], 2*p2[1]-p1[1])) %o A357434 else: # Turn %o A357434 if n>5 and isprime(n-1): turn *= -1 %o A357434 newtp = (p2, (p2[0]-turn*(p1[1]-p2[1]), p2[1]+turn*(p1[0]-p2[0]))) %o A357434 tp.add(newtp) %o A357434 a.append(len(tp)) %o A357434 return a[:nmax+1] %o A357434 print(A357434(100)) %Y A357434 Cf. A187210, A211000, A355479. %K A357434 nonn %O A357434 0,3 %A A357434 _Paolo Xausa_, Sep 28 2022