Beta
[Code Golf] The final countdown?
Description:
Introduction
10, 9, 8, 7, 6, 5, 4, 3, 2, 1, zero.
Increasing the step the countdown may be faster
10, 8, 6, 4, 2, zero.
But will it reach zero?
10, 7, 4, 1, 4294967294, 4294967291, ...
Using 32 bit unsigned integers, sometimes the countdown will eventually reach zero, and sometimes it will loop forever.
Task
Given the start value and the step, determine if the countdown will eventually reach 0
.
Countdown algorithm:
Input
start
: start value, integer. Range:step
: counter step, integer. Range:
Output
True
if the countdown will eventually reach 0
, False
otherwise.
Restrictions
The code should not be longer than 42 bytes.
For compatibility with future versions of python, the code should not contain numeric literals immediately followed by keywords.
1or 2 # no
1 or 2 # ok
Examples
start step | result |
--------------------------------------------
10 1 | True | 10,9,8,7,6,5,4,3,2,1,0.
10 2 | True | 10,8,6,4,2,0.
10 3 | True | 10,7,4,1,4294967294, ..., 5,2,4294967295, ..., 6,3,0.
4 2 | True | 4,2,0.
2 4 | False | 2,4294967294,4294967290, ..., 6,2,4294967294, ...
7 2 | False | 7,5,3,1,4294967295, ..., 3,1,4294967295, ...
Fundamentals
Restricted
Similar Kata:
Stats:
Created | Mar 11, 2025 |
Published | Mar 12, 2025 |
Warriors Trained | 30 |
Total Skips | 0 |
Total Code Submissions | 146 |
Total Times Completed | 9 |
Python Completions | 9 |
Total Stars | 3 |
% of votes with a positive feedback rating | 100% of 4 |
Total "Very Satisfied" Votes | 4 |
Total "Somewhat Satisfied" Votes | 0 |
Total "Not Satisfied" Votes | 0 |
Total Rank Assessments | 4 |
Average Assessed Rank | 5 kyu |
Highest Assessed Rank | 4 kyu |
Lowest Assessed Rank | 7 kyu |