Am I a Special N-bonacci Number?
05AB1E, 18 bytes
[DR²£O©‚˜³®>‹#]³QZ
Try it online!
Uses: [X,Y], N, A
I feel like some unintended functionality made that harder than it needed to be.
There's no greater-than-or-equal-to, never noticed that before.
And #³
didn't work, and required a ]
, for +1 bytes #]³
.
Jelly, 12 bytes
ḣ⁴S;µṀ<⁵µ¿⁵e
A full program taking [X,Y]
, N
, A
.
Try it online!
How?
ḣ⁴S;µṀ<⁵µ¿⁵e - Main link (monadic): [X,Y]
µ µ¿ - while:
Ṁ - maximum value of the list
⁵ - 5th command line argument (3rd input) = A
< - less than?
- ...do:
⁴ - 4th command line argument (2nd input) = N
ḣ - head (get the first N (or less) items from the list)
S - sum
; - concatenate (add the result to the front of the list)
⁵ - 5th command line argument (3rd input) = A
e - exists in the resulting list?
Python 2, 59 56 bytes
a,n,l=input()
while l[0]<a:l=[sum(l[:n])]+l
print a in l
Try it online!
Takes input as A,N,[X,Y]