Timeline for Output endless powers of 2
Current License: CC BY-SA 4.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 30, 2023 at 12:36 | history | edited | Kaddath | CC BY-SA 4.0 |
added 106 characters in body
|
May 30, 2023 at 11:02 | comment | added | Ismael Miguel | You're right. The question is so messy that I didn't notice that. You still have my tip for a separator, if one is needed. However, we can just say that your code is computing a single ever-expanding multiple of 2, and no separator needed. | |
May 30, 2023 at 11:02 | comment | added | Kaddath |
@IsmaelMiguel the shortest to start with 1 would be 22bytes for($n=.5;;)echo$n*=2;
|
|
May 30, 2023 at 11:00 | comment | added | Kaddath | @IsmaelMiguel the question precises "starting at any power of two with finite integer exponent" this answer for example starts with 4 | |
May 30, 2023 at 10:56 | comment | added | Ismael Miguel |
The output is incorrect. It has to start with 1, yours starts with 2. You should do for($n=1;;$n*=2)echo$n; instead, for 23 bytes. If a separator is required, you can do echo$n._; for 25 bytes, for PHP 7.3.44 and older.
|
|
May 30, 2023 at 10:34 | history | answered | Kaddath | CC BY-SA 4.0 |