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

added 321 characters in body
Source Link

Jelly, (削除) 12 (削除ここまで) (削除) 11 (削除ここまで) 9 bytes

ṚḤÐeDFS5ḍ

Try it online!

Explanation coming

How it works

ṚḤÐeDFS5ḍ - Main link. Takes an integer n on the left
Ṛ - Cast n to digits and reverse
 Ðe - To values at even indices:
 Ḥ - Unhalve; Double
 D - Cast to digits
 F - Flatten
 S - Sum
 ḍ - Divisible by:
 5 - 10?

Jelly, (削除) 12 (削除ここまで) (削除) 11 (削除ここまで) 9 bytes

ṚḤÐeDFS5ḍ

Try it online!

Explanation coming

Jelly, (削除) 12 (削除ここまで) (削除) 11 (削除ここまで) 9 bytes

ṚḤÐeDFS5ḍ

Try it online!

How it works

ṚḤÐeDFS5ḍ - Main link. Takes an integer n on the left
Ṛ - Cast n to digits and reverse
 Ðe - To values at even indices:
 Ḥ - Unhalve; Double
 D - Cast to digits
 F - Flatten
 S - Sum
 ḍ - Divisible by:
 5 - 10?
deleted 1039 characters in body
Source Link

Jelly, (削除) 12 (削除ここまで) 11(削除) 11 (削除ここまで) 9 bytes

ṚḤJḤ$¦DFS5ḍṚḤÐeDFS5ḍ

Try it online! (with all test cases)Try it online!

How it works

ṚḤJḤ$¦DFSḍ5 - Main link. Argument: n (integer) e.g. 49927398716
Ṛ - Reverse. Casts a number to digits [6, 1, 7, 8, 9, 3, 7, 2, 9, 9, 4]
 ¦ - Sparse application. Apply the next command to the given indicies
 Ḥ - Command: Double
 $ - Indicies:
 J - range(length)... [1, 2 , 3, 4, 5, 6, 7, 8, 9, 10, 11]
 Ḥ - doubled. [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22]
 - Doubles elements at odd indicies [6, 2, 7, 16, 9, 6, 7, 4, 9, 18, 4]
 D - Split each into digits [6, 2, 7, [1, 6], 9, 6, 7, 4, 9, [1, 8], 4]
 F - Flatten [6, 2, 7, 1, 6, 9, 6, 7, 4, 9, 1, 8, 4]
 S - Sum 70
 ḍ - Divisible by... 
 5 - 10? 1

Alternatively, for 12 bytes:Explanation coming

ṚḤJḤ$¦DFSḍ@5

Jelly, (削除) 12 (削除ここまで) 11 bytes

ṚḤJḤ$¦DFS5ḍ

Try it online! (with all test cases)

How it works

ṚḤJḤ$¦DFSḍ5 - Main link. Argument: n (integer) e.g. 49927398716
Ṛ - Reverse. Casts a number to digits [6, 1, 7, 8, 9, 3, 7, 2, 9, 9, 4]
 ¦ - Sparse application. Apply the next command to the given indicies
 Ḥ - Command: Double
 $ - Indicies:
 J - range(length)... [1, 2 , 3, 4, 5, 6, 7, 8, 9, 10, 11]
 Ḥ - doubled. [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22]
 - Doubles elements at odd indicies [6, 2, 7, 16, 9, 6, 7, 4, 9, 18, 4]
 D - Split each into digits [6, 2, 7, [1, 6], 9, 6, 7, 4, 9, [1, 8], 4]
 F - Flatten [6, 2, 7, 1, 6, 9, 6, 7, 4, 9, 1, 8, 4]
 S - Sum 70
 ḍ - Divisible by... 
 5 - 10? 1

Alternatively, for 12 bytes:

ṚḤJḤ$¦DFSḍ@5

Jelly, (削除) 12 (削除ここまで) (削除) 11 (削除ここまで) 9 bytes

ṚḤÐeDFS5ḍ

Try it online!

Explanation coming

added 106 characters in body
Source Link

Jelly, 12(削除) 12 (削除ここまで) 11 bytes

ṚḤJḤ$¦DFS%5¬ṚḤJḤ$¦DFS5ḍ

Try it online! (with all test cases)

How it works

ṚḤJḤ$¦DFS%5¬ṚḤJḤ$¦DFSḍ5  - Main link. Argument: n (integer) e.g. 49927398716
Ṛ - Reverse. Casts a number to digits [6, 1, 7, 8, 9, 3, 7, 2, 9, 9, 4]
 ¦ - Sparse application. Apply the next command to the given indicies
 Ḥ - Command: Double
 $ - Indicies:
 J - range(length)... [1, 2 , 3, 4, 5, 6, 7, 8, 9, 10, 11]
 Ḥ - doubled. [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22]
 - Doubles elements at odd indicies [6, 2, 7, 16, 9, 6, 7, 4, 9, 18, 4]
 D - Split each into digits [6, 2, 7, [1, 6], 9, 6, 7, 4, 9, [1, 8], 4]
 F - Flatten [6, 2, 7, 1, 6, 9, 6, 7, 4, 9, 1, 8, 4]
 S - Sum 70
 %5 - ModuloDivisible by 10 ... 0
 5 - 10? ¬ - Logical NOT 1

Alternatively, also for 12 bytes:

ṚḤJḤ$¦DFSḍ@5

Jelly, 12 bytes

ṚḤJḤ$¦DFS%5¬

Try it online! (with all test cases)

How it works

ṚḤJḤ$¦DFS%5¬ - Main link. Argument: n (integer) e.g. 49927398716
Ṛ - Reverse. Casts a number to digits [6, 1, 7, 8, 9, 3, 7, 2, 9, 9, 4]
 ¦ - Sparse application. Apply the next command to the given indicies
 Ḥ - Command: Double
 $ - Indicies:
 J - range(length)...
 Ḥ - doubled.
 - Doubles elements at odd indicies [6, 2, 7, 16, 9, 6, 7, 4, 9, 18, 4]
 D - Split each into digits [6, 2, 7, [1, 6], 9, 6, 7, 4, 9, [1, 8], 4]
 F - Flatten [6, 2, 7, 1, 6, 9, 6, 7, 4, 9, 1, 8, 4]
 S - Sum 70
 %5 - Modulo by 10  0
 ¬ - Logical NOT 1

Alternatively, also for 12 bytes:

ṚḤJḤ$¦DFSḍ@5

Jelly, (削除) 12 (削除ここまで) 11 bytes

ṚḤJḤ$¦DFS5ḍ

Try it online! (with all test cases)

How it works

ṚḤJḤ$¦DFSḍ5  - Main link. Argument: n (integer) e.g. 49927398716
Ṛ - Reverse. Casts a number to digits [6, 1, 7, 8, 9, 3, 7, 2, 9, 9, 4]
 ¦ - Sparse application. Apply the next command to the given indicies
 Ḥ - Command: Double
 $ - Indicies:
 J - range(length)... [1, 2 , 3, 4, 5, 6, 7, 8, 9, 10, 11]
 Ḥ - doubled. [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22]
 - Doubles elements at odd indicies [6, 2, 7, 16, 9, 6, 7, 4, 9, 18, 4]
 D - Split each into digits [6, 2, 7, [1, 6], 9, 6, 7, 4, 9, [1, 8], 4]
 F - Flatten [6, 2, 7, 1, 6, 9, 6, 7, 4, 9, 1, 8, 4]
 S - Sum 70
  - Divisible by... 5 - 10? 1

Alternatively, for 12 bytes:

ṚḤJḤ$¦DFSḍ@5
Source Link
Loading

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