A261790 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.
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, 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, 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
Offset: 0
Examples
Triangle starts: 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, 7, 7, 1; 1, 16, 8, 16, 4, 16, 8, 16, 1; ...
References
- Harold Abelson and Andrea diSessa, Turtle Geometry, Artificial Intelligence Series, MIT Press, July 1986, pp. 20 and 36.
- 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.
Programs
-
Mathematica
{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 *)
-
PARI
T(n, k) = {if (n==0, return (1)); m=1; while(((k*m*(m+1)/2) % n) || (k*m % n), m++); m;} row(n) = vector(n+1, k, k--; T(n,k)); tabl(nn) = for(n=0, nn, print(row(n)));
Comments