login
Regular triangle read by rows: T(n,k) is the least positive number m such that k*m and k*m*(m+1)/2 are both divisible by n, with 0<=k<=n and T(0,0)=1.
0

%I #11 Sep 01 2015 10:32:32

%S 1,1,1,1,4,1,1,3,3,1,1,8,4,8,1,1,5,5,5,5,1,1,12,3,4,3,12,1,1,7,7,7,7,

%T 7,7,1,1,16,8,16,4,16,8,16,1,1,9,9,3,9,9,3,9,9,1,1,20,5,20,5,4,5,20,5,

%U 20,1,1,11,11,11,11,11,11,11,11,11,11,1,1,24,12,8,3,24,4,24,3,8,12,24,1

%N Regular triangle read by rows: T(n,k) is the least positive number m such that k*m and k*m*(m+1)/2 are both divisible by n, with 0<=k<=n and T(0,0)=1.

%C T(360,k) is the number of steps for a Logo turtle to return to the same orientation and same heading when using the INSPIR program with starting angle and angular increment k.

%D Harold Abelson and Andrea diSessa, Turtle Geometry, Artificial Intelligence Series, MIT Press, July 1986, pp. 20 and 36.

%D Brian Hayes, La tortue vagabonde, in Récréations Informatiques, Pour La Science, Belin, Paris, 1987, pp. 24-28, in French, translation from Computer Recreations, February 1984, Scientific American Volume 250, Issue 2.

%e Triangle starts:

%e 1;

%e 1, 1;

%e 1, 4, 1;

%e 1, 3, 3, 1;

%e 1, 8, 4, 8, 1;

%e 1, 5, 5, 5, 5, 1;

%e 1, 12, 3, 4, 3, 12, 1;

%e 1, 7, 7, 7, 7, 7, 7, 1;

%e 1, 16, 8, 16, 4, 16, 8, 16, 1;

%e ...

%t {1}~Join~Table[m = 1; While[Nand[Mod[k m, n] == 0, Mod[k m (m + 1)/2, n] == 0], m++]; m, {n, 12}, {k, 0, n}] // Flatten (* _Michael De Vlieger_, Sep 01 2015 *)

%o (PARI) T(n, k) = {if (n==0, return (1)); m=1; while(((k*m*(m+1)/2) % n) || (k*m % n), m++); m;}

%o row(n) = vector(n+1, k, k--; T(n,k));

%o tabl(nn) = for(n=0, nn, print(row(n)));

%Y Cf. A011772, A022998 (2nd column).

%K nonn,tabl

%O 0,5

%A _Michel Marcus_, Sep 01 2015