login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A308673 For n > 2, if there exists an m < n such that a(m) = a(n), take the largest such m and set a(n+1) = a(n)+(n-m); otherwise a(n+1) = 1. Start with a(1)=0, a(2)=0. 0

%I

%S 0,0,1,1,2,1,3,1,3,5,1,4,1,3,8,1,4,9,1,4,7,1,4,7,10,1,5,22,1,4,11,1,4,

%T 7,17,1,5,15,1,4,11,21,1,5,12,1,4,11,18,1,5,12,19,1,5,9,47,1,5,9,13,1,

%U 5,9,13,17,48,1,7,42

%N For n > 2, if there exists an m < n such that a(m) = a(n), take the largest such m and set a(n+1) = a(n)+(n-m); otherwise a(n+1) = 1. Start with a(1)=0, a(2)=0.

%C It appears that if you choose "otherwise a(n+1) = x" to be a different integer, that the sequence starts to look the same, but offset in position and value. For example, if you compare the case where "otherwise a1(n+1) = 1" and "otherwise a2(n+1) = 2" then a1(n) = a2(n+3)-2.

%t a[1] = a[2] = 0; a[n_] := a[n] = Module[{k = n-2}, While[k > 0 && a[k] != a[n-1], k--]; If[k==0, 1, a[n-1] + n - k - 1]]; Array[a,100] (* _Amiram Eldar_, Jul 12 2019 *)

%o (Python)

%o def Prog(length):

%o L = 2

%o seq = [0,0]

%o while L < length:

%o x = len(seq)-1

%o while x > 0:

%o if seq[-1] == seq[x-1]:

%o m = len(seq)-x

%o a_n = seq[L-1]

%o seq.append(a_n+m)

%o x = -1

%o else:

%o x -= 1

%o if x == 0:

%o seq.append(1)

%o L += 1

%o return seq

%Y Cf. A181391.

%K nonn

%O 1,5

%A _Philip Kalisman_, Jul 07 2019

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified November 28 05:30 EST 2021. Contains 349401 sequences. (Running on oeis4.)