A210838 Coordinates (x,y) of the endpoint of a structure (or curve) formed by Q-toothpicks of size = 1..n. The inflection points are the n-th nodes if n is a triangular number A000217.
0, 0, 1, 1, 3, 3, 0, 6, -4, 10, 1, 15, 7, 9, 14, 2, 22, 10, 13, 19, 3, 9, -8, -2, -20, 10, -7, 23, 7, 9, -8, -6, -24, -22, -7, -39, 11, -21, -8, -2, -28, -22, -7, -43, 15, -65, -8, -88, -32, -64, -7, -39, 19, -65, -8, -92, -36, -64, -65, -35, -95, -65, -64, -96
Offset: 0
Examples
------------------------------------- Stage n also The end as the size of Pair inflection Q-toothpick (x y) point ------------------------------------- . 0 0, 0, - . 1 1, 1, Yes . 2 3, 3, - . 3 0, 6, Yes . 4 -4, 10, - . 5 1, 15, - . 6 7, 9, Yes . 7 14, 2, - . 8 22, 10, - . 9 13, 19, - . 10 3, 9, Yes . 11 -8, -2, - . 12 -20, 10, - . 13 -7, 23, - . 14 7, 9, - . 15 -8, -6, Yes
Links
- Paolo Xausa, Table of n, a(n) for n = 0..9999
- N. J. A. Sloane, Catalog of Toothpick and Cellular Automata Sequences in the OEIS
- Paolo Xausa, Animation of terms n = 0..41 (first 21 coordinate pairs), where orange dots are toothpick endpoints (hollow dots are inflection points) and blue dots are toothpick centers
- Paolo Xausa, Animation of terms n = 0..507 (first 254 coordinate pairs)
- Paolo Xausa, Scatterplot of 10^5 coordinate pairs
- Index entries for sequences related to toothpick sequences
Crossrefs
Programs
-
Mathematica
A210838[nmax_]:=Module[{ep={0, 0}, angle=3/4Pi, turn=Pi/2, infl=0}, Join[{ep}, Table[If[n>1&&IntegerQ[Sqrt[8(n-1)+1]], infl++, If[Mod[infl, 2]==1, turn*=-1]; angle-=turn; infl=0]; ep=AngleVector[ep, {Sqrt[2]n, angle}], {n, nmax}]]]; A210838[100] (* Generates 101 coordinate pairs *) (* Paolo Xausa, Jan 12 2023 *)
-
PARI
A210838(nmax) = my(ep=vector(nmax+1), turn=1, infl=0, ep1, ep2); ep[1]=[0, 0]; if(nmax==0, return(ep)); ep[2]=[1, 1]; for(n=2, nmax, ep1=ep[n-1]; ep2=ep[n]; if(issquare((n-1)<<3+1), infl++; ep[n+1]=[ep2[1]+n*sign(ep2[1]-ep1[1]), ep2[2]+n*sign(ep2[2]-ep1[2])], if(infl%2, turn*=-1); infl=0; ep[n+1]=[ep2[1]-turn*n*sign(ep1[2]-ep2[2]), ep2[2]+turn*n*sign(ep1[1]-ep2[1])])); ep; A210838(100) \\ Generates 101 coordinate pairs - Paolo Xausa, Jan 12 2023
-
Python
from numpy import sign from sympy import integer_nthroot def A210838(nmax): ep, turn, infl = [(0, 0), (1, 1)], 1, 0 for n in range(2, nmax + 1): ep1, ep2 = ep[-2], ep[-1] if integer_nthroot(((n - 1) << 3) + 1, 2)[1]: # Continue straight infl += 1 dx = n * sign(ep2[0] - ep1[0]) dy = n * sign(ep2[1] - ep1[1]) else: # Turn if infl % 2: turn *= -1 infl = 0 dx = turn * n * sign(ep2[1] - ep1[1]) dy = turn * n * sign(ep1[0] - ep2[0]) ep.append((ep2[0] + dx, ep2[1] + dy)) return ep[:nmax+1] print(A210838(100)) # Generates 101 coordinate pairs - Paolo Xausa, Jan 12 2023
Extensions
a(30)-a(33) corrected and more terms by Paolo Xausa, Jan 12 2023
Comments