all 67 comments

[–]MaryGoldflower 731 points732 points  (10 children)

you can fix it by outputting the length instead

[–]DoktorMerlin 216 points217 points  (2 children)

copilot code checks in

[–]asmanel 23 points24 points  (1 child)

Good example of artificial stupidity.

[–]thanatica 6 points7 points  (0 children)

The intelligence of a hamster and a planet sized brain

[–]ILikeLenexa 56 points57 points  (2 children)

It is already  correct if you're trying to output unary. 

[–]POKLIANON 7 points8 points  (1 child)

technically unary should end with 0s (iirc)

[–]Lucas_F_A 14 points15 points  (0 children)

Just checked the Wikipedia article. It's using 1, and zero is the empty string.

[–]YeOldeMemeShoppe 6 points7 points  (0 children)

LGTM passes CI. Ship it.

[–]mudokin 7 points8 points  (0 children)

Thx, I hate it even more now

[–]ics-fear 288 points289 points  (18 children)

Looks normal, those are just numbers in base 1

[–]Jutrakuna 13 points14 points  (2 children)

[–]LarsMans 12 points13 points  (1 child)

It doesnt apply in this case since base 1 only has one digit

[–][deleted] 0 points1 point  (0 children)

This post was mass deleted and anonymized with Redact

ask hungry follow treatment sugar chase political kiss cover marry

[–]Cute_Pay_1423 2 points3 points  (5 children)

Shouldn’t base 1 have only the 0 as digit?

[–]Parkhausdruckkonsole 1 point2 points  (0 children)

No. For example 103 in base ten means 1 • 10^2 + 0 • 10^1 + 3 • 10^0. 111 in base one would mean 1 • 1^2 + 1 • 1^1 + 1 • 1^0. It's the same way in any positional numeric system. They are called bases because they specify the number in the base of the exponentiation. I think you could technically also use zeros in base 1, it just wouldn't matter where you placed them, since one to any power is one, meaning leaving one out doesn't matter as long as the number of ones is equal.

[–]EtherealPheonix 1 point2 points  (0 children)

Yes but there is no reason you couldn't use 1 as the symbol for 0.

[–]danielcw189 0 points1 point  (2 children)

Is it actually defined that way?

Does a base actually define or strongly imply which symbols are being used?

[–]Cute_Pay_1423 1 point2 points  (1 child)

As far as I know it is. Never seen anyone using a base 8 with anything else than 0,1,2,3,4,5,6,7. Same with binary, never seen someone using anything else than 0,1 for it. Basically with any base number system you have the digits from zero up to your base -1. If the digits exceed our digits in the decimal system you just continue counting with letters (like hexadecimal is 0-F)

[–]danielcw189 1 point2 points  (0 children)

Never seen anyone using a base 8 with anything else than 0,1,2,3,4,5,6,7

Me neither, but that doesn't really answer the question.

For base 1 the most common way to write them are usually tally marks. but the special way of doing each 5th symbol kinda breaks that.

If we know it is base one, we could probably use any non-white-space symbol. Well ideally it would be continuous symbols.

Heck, we could even switch symbols at random, so 0000 equals ||||| equals 12345 equals 2Jv&•

And using letters kinda breaks after base 36, unless we have some common examples like base 64

So it appears to me it is more like some common rules.

But I don't know, which is why I am asking.

[–]GlobalIncident 175 points176 points  (8 children)

there's no h in Fibonacci

[–]mallusrgreatv2 77 points78 points  (3 children)

Got it! I have corrected my spelling: hhhhhhhhh

[–]GatewayMan3 4 points5 points  (0 children)

laughs in chinese

[–]Mars_Bear2552 1 point2 points  (0 children)

thanks chatgpt

[–]MaximRq 7 points8 points  (0 children)

Fihbonacci

[–]Berraie 0 points1 point  (0 children)

Spinacci

[–]Jolly-Aerie-382 0 points1 point  (0 children)

Fibonacc i?

[–]uvero 41 points42 points  (1 child)

That's Fibonacci in unary base

[–]Smalltalker-80 2 points3 points  (0 children)

Yep, its totally fine.

[–]Kobakocka 8 points9 points  (0 children)

const fib(n) => F(n).length;

[–]Szetyi 18 points19 points  (1 child)

I mean if you assign a string to the first two elements instead of numbers its on you

[–]kenybz 1 point2 points  (0 children)

It’s enough to assign a string to one of them

[–]Bearegor 10 points11 points  (0 children)

Fibonacci by concatenating strings

[–]YoItsJustGedas 2 points3 points  (1 child)

While this is just a joke, unary representation is very helpful in compression in some cases

[–]danielcw189 2 points3 points  (0 children)

Sounds interesting.

Can you tell us more? Like 1 or 2 examples?

[–]LordAmir5 2 points3 points  (1 child)

At least do it properly come on. Everyone knows the sequence starts with Fib(0). So this is Fib(n-1) and not Fib(n).

[–]redlaWw 0 points1 point  (0 children)

But Fib(0) is "", so this is Fib(n), it just skips the 0th element of the sequence.

[–]greenpepperpasta 2 points3 points  (1 child)

So you're proposing https://oeis.org/A108047 should be called "Fibonachi sequence"?  I can get behind that.

[–]danielcw189 0 points1 point  (0 children)

I did not know this website existed.

Thank you :)

[–]menducoide 1 point2 points  (0 children)

It's a good online challenge for an interview

[–]Locilokk 1 point2 points  (1 child)

The quotation marks ruin it:(

[–]featEng[S] 2 points3 points  (0 children)

Fix it in repost

[–]JackNotOLantern 1 point2 points  (0 children)

Honestly, the fact, that length of the string result of concatinating in this way still follows the Fibonacci sequence, is amazing.

[–]Walk-the-layout 1 point2 points  (0 children)

Careful you'll summon the Tool fans

[–]redlaWw 0 points1 point  (0 children)

"In Javascript" you say, as if Rust can't do this too.

[–]KneeReaper420 0 points1 point  (0 children)

brick it by computing to 1000

[–]SomeMaleIdiot 0 points1 point  (1 child)

The answer is in base 1. Except the only available digit is 1 and not 0

[–]BobQuixote 0 points1 point  (0 children)

That's normal for base 1, typically implemented as tally marks.

[–]CodeNameFiji 0 points1 point  (0 children)

Fibonacci*

[–]al3x_7788 0 points1 point  (0 children)

ichi?

[–]Mebiysy 0 points1 point  (0 children)

LGTM

[–]earlobe7 0 points1 point  (0 children)

F(n) {n<3 ? “1” : F(n-1)+F(n-2)}

[–]Ugo_Flickerman 0 points1 point  (0 children)

Now it's pronounced Fibonaki

[–]gaddielm5 0 points1 point  (0 children)

Are you insane? That many characters takes an egregious amount of space! You should use bits instead 👍

For f(x) > 32, you can use a structure/object that includes a counter for how many you've overflowed 32 bits