A211000 Coordinates (x,y) of the endpoint of a structure (or curve) formed by Q-toothpicks in which the inflection points are the prime numbers A000040.
0, 0, 1, 1, 2, 0, 3, -1, 4, -2, 3, -3, 2, -4, 3, -5, 4, -6, 3, -7, 2, -6, 3, -5, 4, -4, 3, -3, 2, -2, 3, -1, 4, -2, 3, -3, 2, -4, 3, -5, 4, -6, 3, -7, 2, -6, 3, -5, 4, -4, 3, -3, 2, -4, 3, -5, 4, -4, 3, -3, 2, -2, 3, -1, 4, 0, 3, 1, 2, 0, 3, -1, 4, 0
Offset: 0
Examples
We start at stage 0 with no Q-toothpicks. At stage 1 we place a Q-toothpick centered at (1,0) with its endpoints at (0,0) and (1,1). At stage 2 we place a Q-toothpick centered at (1,0) with its endpoints at (1,1) and (2,0). Since 2 is a prime number we have that the end of the curve is also an inflection point. At stage 3 we place a Q-toothpick centered at (3,0) with its endpoints at (2,0) and (3,-1). Since 3 is a prime number we have that the end of the curve is also an inflection point. At stage 4 we place a Q-toothpick centered at (3,-2) with its endpoints at (3,-1) and (4,-2). ------------------------------------- . The end as . Pair inflection n (x y) point ------------------------------- 0 0, 0, - 1 1, 1, - 2 2, 0, Yes 3 3, -1, Yes 4 4, -2, - 5 3, -3, Yes 6 2, -4, - 7 3, -5, Yes 8 4, -6, - 9 3, -7, - 10 2, -6, - 11 3, -5, Yes ... Illustration of the nodes of the structure: ----------------------------------------------------- After 9 stages After 10 stages After 11 stages ----------------------------------------------------- . . 1 1 1 . 0 2 0 2 0 2 . 3 3 3 . 4 4 4 . 5 5 5 . 6 6 6 . 7 7 11 . 8 10 8 10 8 . 9 9 9 .
Links
Crossrefs
Programs
-
Mathematica
A211000[nmax_]:=Module[{walk={{0,0}},angle=3/4Pi,turn=Pi/2},Do[If[!PrimeQ[n],If[n>5&&PrimeQ[n-1],turn*=-1];angle-=turn];AppendTo[walk,AngleVector[Last[walk],{Sqrt[2],angle}]],{n,0,nmax-1}];walk]; A211000[100] (* Generates 101 coordinate pairs *) (* Paolo Xausa, Aug 23 2022 *)
-
PARI
A211000(nmax) = my(walk=vector(nmax+1), turn=1, p1, p2); walk[1]=[0,0];if(nmax==0,return(walk));walk[2]=[1,1];for(n=1, nmax-1, p1=walk[n];p2=walk[n+1];if(isprime(n),walk[n+2]=[2*p2[1]-p1[1],2*p2[2]-p1[2]],if(n>5 && isprime(n-1), turn*=-1);walk[n+2]=[p2[1]-turn*(p1[2]-p2[2]),p2[2]+turn*(p1[1]-p2[1])]));walk; A211000(100) \\ Generates 101 coordinate pairs - Paolo Xausa, Sep 22 2022
-
Python
from sympy import isprime def A211000(nmax): walk, turn = [(0,0),(1,1)], 1 for n in range(1,nmax): p1, p2 = walk[-2], walk[-1] if isprime(n): # Go straight walk.append((2*p2[0]-p1[0],2*p2[1]-p1[1])) else: # Turn if n>5 and isprime(n-1): turn *= -1 walk.append((p2[0]-turn*(p1[1]-p2[1]),p2[1]+turn*(p1[0]-p2[0]))) return walk[:nmax+1] print(A211000(100)) # Generates 101 coordinate pairs - Paolo Xausa, Sep 22 2022
Comments