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

Commonmark migration
Source Link

#Japt , (削除) 41 (削除ここまで)(削除) 36 (削除ここまで)(削除) 32 (削除ここまで)(削除) 29 (削除ここまで) 25 bytes

Japt , (削除) 41 (削除ここまで)(削除) 36 (削除ここまで)(削除) 32 (削除ここまで)(削除) 29 (削除ここまで) 25 bytes

_p1 ä+T}h[]à)m£_XuVpZa7}f

Try it

 h ) // run input times
 []à // starting with empty 2d array (permutations of [])
_ } // function that:
 p1 // appends 1
 T // and prepends 0
 ä+ // sums consecutive elements
 
m // for each line
 £ // for each element
 f // find first number (starting at 0) that return false this function: 
 _ } // f(Z)
 Xu // triangle element modulo
 Vp // 2nd input raised to 
 Za8 // absolute difference 

Uses numbers [7...0] as colors Footer inverts colors to [0...7] for simpler output

Saved a lot thanks to @Shaggy

#Japt , (削除) 41 (削除ここまで)(削除) 36 (削除ここまで)(削除) 32 (削除ここまで)(削除) 29 (削除ここまで) 25 bytes

_p1 ä+T}h[]à)m£_XuVpZa7}f

Try it

 h ) // run input times
 []à // starting with empty 2d array (permutations of [])
_ } // function that:
 p1 // appends 1
 T // and prepends 0
 ä+ // sums consecutive elements
 
m // for each line
 £ // for each element
 f // find first number (starting at 0) that return false this function: 
 _ } // f(Z)
 Xu // triangle element modulo
 Vp // 2nd input raised to 
 Za8 // absolute difference 

Uses numbers [7...0] as colors Footer inverts colors to [0...7] for simpler output

Saved a lot thanks to @Shaggy

Japt , (削除) 41 (削除ここまで)(削除) 36 (削除ここまで)(削除) 32 (削除ここまで)(削除) 29 (削除ここまで) 25 bytes

_p1 ä+T}h[]à)m£_XuVpZa7}f

Try it

 h ) // run input times
 []à // starting with empty 2d array (permutations of [])
_ } // function that:
 p1 // appends 1
 T // and prepends 0
 ä+ // sums consecutive elements
 
m // for each line
 £ // for each element
 f // find first number (starting at 0) that return false this function: 
 _ } // f(Z)
 Xu // triangle element modulo
 Vp // 2nd input raised to 
 Za8 // absolute difference 

Uses numbers [7...0] as colors Footer inverts colors to [0...7] for simpler output

Saved a lot thanks to @Shaggy

@Shaggy suggestions
Source Link
AZTECCO
  • 11k
  • 1
  • 17
  • 60

#Japt -R, (削除) 41 (削除ここまで) (削除) 36 (削除ここまで) (削除) 32 (削除ここまで) 29(削除) 29 (削除ここまで) 25 bytes

_ä+0_p1 p1ä+T}h[1â]
Ë£_XuVpZa7h[]à)m£_XuVpZa7}f a7

Try it Try it

_äÈ+Y}0 p1} h  ) // frun =input prependtimes
 0 to []à // starting with empty 2d array and(permutations sumsof each[])
_ pairs, then }  // function that:
 p1 // appends 1
 T h[1â] // runand fprepends input0
 times startingä+ with [[1]]
 // sums consecutive elements
Ë 
m // for each line
 £ // for each element
 _XuVpZa7} // f =// returnfind elementfirst modulonumber (starting 2ndat input0) raisedthat toreturn 7false -this parameter)function: 
 _ } // f(Z)
 Xu  // runtriangle felement startingmodulo
 with 0 , return firstVp number to return a modulo 0
// 2nd input raised to a7Za8  // absolute difference with 7

Uses numbers [0[7...7]0] as colors Footer inverts colors to [0...7] for simpler output

Saved 3a lot thanks to @Shaggy

#Japt -R, (削除) 41 (削除ここまで) (削除) 36 (削除ここまで) (削除) 32 (削除ここまで) 29 bytes

_ä+0 p1}h[1â]
Ë£_XuVpZa7}f a7

Try it

_äÈ+Y}0 p1} // f = prepend 0 to array and sums each pairs, then appends 1
 h[1â] // run f input times starting with [[1]]

Ë // for each line
 £ // for each element
 _XuVpZa7} // f = return element modulo ( 2nd input raised to 7 - parameter)
 f // run f starting with 0 , return first number to return a modulo 0
 a7 // absolute difference with 7

Uses numbers [0...7] as colors

Saved 3 thanks to @Shaggy

#Japt, (削除) 41 (削除ここまで) (削除) 36 (削除ここまで) (削除) 32 (削除ここまで) (削除) 29 (削除ここまで) 25 bytes

_p1 ä+T}h[]à)m£_XuVpZa7}f

Try it

 h  ) // run input times
  []à // starting with empty 2d array (permutations of [])
_  }  // function that:
 p1 // appends 1
 T // and prepends 0
 ä+  // sums consecutive elements
 
m // for each line
 £ // for each element
 f // find first number (starting at 0) that return false this function: 
 _ } // f(Z)
 Xu  // triangle element modulo
 Vp // 2nd input raised to Za8  // absolute difference 

Uses numbers [7...0] as colors Footer inverts colors to [0...7] for simpler output

Saved a lot thanks to @Shaggy

@Shaggy suggestion
Source Link
AZTECCO
  • 11k
  • 1
  • 17
  • 60

#Japt -R, (削除) 41 (削除ここまで) (削除) 36 (削除ここまで) 32 (削除) 32 (削除ここまで) 29 bytes

_äÈ+Y}0_ä+0 p1}h[1â]
Ë£_XuVpZa7}f a7

Try it Try it

_äÈ+Y}0 p1} // f = prepend 0 to array and sums each pairs, then appends 1
 h[1â] // run f input times starting with [[1]]
Ë // for each line
 £ // for each element
 _XuVpZa7} // f = return element modulo ( 2nd input raised to 7 - parameter)
 f // run f starting with 0 , return first number to return a modulo 0
 a7 // absolute difference with 7

Uses numbers [0...7] as colors

Saved 3 thanks to @Shaggy

#Japt -R, (削除) 41 (削除ここまで) (削除) 36 (削除ここまで) 32 bytes

_äÈ+Y}0 p1}h[1â]
Ë£_XuVpZa7}f a7

Try it

_äÈ+Y}0 p1} // f = prepend 0 to array and sums each pairs, then appends 1
 h[1â] // run f input times starting with [[1]]
Ë // for each line
 £ // for each element
 _XuVpZa7} // f = return element modulo ( 2nd input raised to 7 - parameter)
 f // run f starting with 0 , return first number to return a modulo 0
 a7 // absolute difference with 7

Uses numbers [0...7] as colors

#Japt -R, (削除) 41 (削除ここまで) (削除) 36 (削除ここまで) (削除) 32 (削除ここまで) 29 bytes

_ä+0 p1}h[1â]
Ë£_XuVpZa7}f a7

Try it

_äÈ+Y}0 p1} // f = prepend 0 to array and sums each pairs, then appends 1
 h[1â] // run f input times starting with [[1]]
Ë // for each line
 £ // for each element
 _XuVpZa7} // f = return element modulo ( 2nd input raised to 7 - parameter)
 f // run f starting with 0 , return first number to return a modulo 0
 a7 // absolute difference with 7

Uses numbers [0...7] as colors

Saved 3 thanks to @Shaggy

edited body
Source Link
AZTECCO
  • 11k
  • 1
  • 17
  • 60
Loading
Improved 2nd line
Source Link
AZTECCO
  • 11k
  • 1
  • 17
  • 60
Loading
added 7 characters in body
Source Link
AZTECCO
  • 11k
  • 1
  • 17
  • 60
Loading
Improved first line
Source Link
AZTECCO
  • 11k
  • 1
  • 17
  • 60
Loading
Source Link
AZTECCO
  • 11k
  • 1
  • 17
  • 60
Loading

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