Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

deleted 38 characters in body
Source Link
Parcly Taxel
  • 4.7k
  • 1
  • 8
  • 55

Wolfram Language (Mathematica), 6348 bytes

Nest[ArrayFlatten@Map[Curry[4#2+#&]@#,Nest[ArrayFlatten@{{04#,24#+2},{34#+3,14#+1}},{2}]&&,0,#]&

Try it online! Try it online!

Input is \$\log_2s\$, output is an integer matrix with entries starting from 0. Modified from the recursive formula on the Wikipedia page for ordered dithering: $$M_{2s}=\begin{bmatrix}4M_s&4M_s+2\\ 4M_s+3&4M_s+1 \end{bmatrix}$$

Wolfram Language (Mathematica), 63 bytes

Nest[ArrayFlatten@Map[Curry[4#2+#&]@#,{{0,2},{3,1}},{2}]&,0,#]&

Try it online!

Input is \$\log_2s\$, output is an integer matrix with entries starting from 0. Modified from the recursive formula on the Wikipedia page for ordered dithering: $$M_{2s}=\begin{bmatrix}4M_s&4M_s+2\\ 4M_s+3&4M_s+1 \end{bmatrix}$$

Wolfram Language (Mathematica), 48 bytes

Nest[ArrayFlatten@{{4#,4#+2},{4#+3,4#+1}}&,0,#]&

Try it online!

Input is \$\log_2s\$, output is an integer matrix with entries starting from 0. Modified from the recursive formula on the Wikipedia page for ordered dithering: $$M_{2s}=\begin{bmatrix}4M_s&4M_s+2\\ 4M_s+3&4M_s+1 \end{bmatrix}$$

deleted 19 characters in body
Source Link
Parcly Taxel
  • 4.7k
  • 1
  • 8
  • 55

Wolfram Language (Mathematica), 63 bytes

Nest[ArrayFlatten@Map[Curry[4#2+#&]@#,{{0,2},{3,1}},{2}]&,0,#]&

Try it online!

Input is \$\log_2s\$, output is an integer matrix with entries starting from 0 of shape \$(s,s)\$. Modified from the recursive formula on the Wikipedia page for ordered dithering: $$M_{2s}=\begin{bmatrix}4M_s&4M_s+2\\ 4M_s+3&4M_s+1 \end{bmatrix}$$

Wolfram Language (Mathematica), 63 bytes

Nest[ArrayFlatten@Map[Curry[4#2+#&]@#,{{0,2},{3,1}},{2}]&,0,#]&

Try it online!

Input is \$\log_2s\$, output is an integer matrix with entries starting from 0 of shape \$(s,s)\$. Modified from the recursive formula on the Wikipedia page for ordered dithering: $$M_{2s}=\begin{bmatrix}4M_s&4M_s+2\\ 4M_s+3&4M_s+1 \end{bmatrix}$$

Wolfram Language (Mathematica), 63 bytes

Nest[ArrayFlatten@Map[Curry[4#2+#&]@#,{{0,2},{3,1}},{2}]&,0,#]&

Try it online!

Input is \$\log_2s\$, output is an integer matrix with entries starting from 0. Modified from the recursive formula on the Wikipedia page for ordered dithering: $$M_{2s}=\begin{bmatrix}4M_s&4M_s+2\\ 4M_s+3&4M_s+1 \end{bmatrix}$$

added 27 characters in body
Source Link
Parcly Taxel
  • 4.7k
  • 1
  • 8
  • 55

Wolfram Language (Mathematica), 8363 bytes

Nest[ArrayFlatten[Map[Curry[#2+#/Length[#2]^2&][#]Nest[ArrayFlatten@Map[Curry[4#2+#&]@#,{{0,2},{3,1}}/4,{2}]]&]&,{{0}},#]&

Try it online! Try it online!

UsesInput is \$\log_2s\$, output is an integer matrix with entries starting from 0 of shape \$(s,s)\$. Modified from the recursive formula on the Wikipedia page for ordered dithering: $$M_{2s}=\begin{bmatrix}M_s&M_s+2/(2s)^2\\ M_s+3/(2s)^2&M_s+1/(2s)^2 \end{bmatrix}$$$$M_{2s}=\begin{bmatrix}4M_s&4M_s+2\\ 4M_s+3&4M_s+1 \end{bmatrix}$$

Wolfram Language (Mathematica), 83 bytes

Nest[ArrayFlatten[Map[Curry[#2+#/Length[#2]^2&][#],{{0,2},{3,1}}/4,{2}]]&,{{0}},#]&

Try it online!

Uses the recursive formula on the Wikipedia page for ordered dithering: $$M_{2s}=\begin{bmatrix}M_s&M_s+2/(2s)^2\\ M_s+3/(2s)^2&M_s+1/(2s)^2 \end{bmatrix}$$

Wolfram Language (Mathematica), 63 bytes

Nest[ArrayFlatten@Map[Curry[4#2+#&]@#,{{0,2},{3,1}},{2}]&,0,#]&

Try it online!

Input is \$\log_2s\$, output is an integer matrix with entries starting from 0 of shape \$(s,s)\$. Modified from the recursive formula on the Wikipedia page for ordered dithering: $$M_{2s}=\begin{bmatrix}4M_s&4M_s+2\\ 4M_s+3&4M_s+1 \end{bmatrix}$$

deleted 6 characters in body
Source Link
Parcly Taxel
  • 4.7k
  • 1
  • 8
  • 55
Loading
added 141 characters in body
Source Link
Parcly Taxel
  • 4.7k
  • 1
  • 8
  • 55
Loading
Source Link
Parcly Taxel
  • 4.7k
  • 1
  • 8
  • 55
Loading

AltStyle によって変換されたページ (->オリジナル) /