login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A309023
For n >= 1, if there exists an m < n such that a(m) = a(n), take the largest such m and set a(n+1) = (n-m)^a(n); otherwise a(n+1) = 0. Start with a(1)=1, a(2)=2.
0
1, 2, 0, 0, 1, 4, 0, 1, 3, 0, 1, 3, 27, 0, 1, 4, 10000, 0, 1, 4, 256, 0, 1, 4, 256
OFFSET
1,2
COMMENTS
This sequence quickly generates terms of immense size.
Changing what a(n+1) is set to when a new term arises changes the sequence nontrivially.
MATHEMATICA
Nest[Function[{a, n}, Append[a, If[Length@ # == 0, 0, (n - #[[-1, 1]])^Last@ a] &@ Position[Most@ a, _?(# == Last@ a &)] ]] @@ {#, Length@ #} &, {1, 2}, 24] (* Michael De Vlieger, Jul 08 2019 *)
PROG
(Python)
def Prog(length):
L = 2
seq = [1, 2]
while L < length:
x = len(seq)-1
while x > 0:
if seq[-1] == seq[x-1]:
m_minus_n = len(seq)-x
a_n = seq[L-1]
seq.append((m_minus_n)**a_n)
x = -1
else:
x -= 1
if x == 0:
seq.append(0)
L += 1
return seq
CROSSREFS
Cf. A181391.
Sequence in context: A109077 A378178 A355916 * A353429 A137585 A301344
KEYWORD
nonn
AUTHOR
Philip Kalisman, Jul 07 2019
STATUS
approved