login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A284511 a(1) = 1, a(2) = 2, a(3) = 2; a(n) = a(a(n-1)-1) + a(n-a(n-2)) for n > 3. 3
1, 2, 2, 3, 4, 4, 4, 5, 7, 8, 7, 7, 8, 8, 8, 9, 12, 14, 12, 11, 15, 15, 13, 14, 15, 15, 15, 16, 16, 16, 16, 17, 21, 23, 23, 23, 23, 23, 24, 25, 26, 27, 27, 27, 29, 28, 29, 27, 26, 28, 30, 30, 29, 30, 31, 31, 31, 31, 32, 32, 32, 32, 32, 33, 38, 44, 43, 41, 40, 40, 40, 41, 46, 50 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
LINKS
FORMULA
a(n) = a(a(n-1)-1) + a(n-a(n-2)), with a(1) = 1, a(2) = 2, a(3) = 2.
EXAMPLE
a(4) = 3 because a(4) = a(a(3) - 1) + a(4 - a(2)) = a(1) + a(2) = 3.
MAPLE
a:= proc(n) option remember;
procname(procname(n-1)-1)+procname(n-procname(n-2))
end proc:
a(1):= 1: a(2):= 2: a(3):= 2:
map(a, [$1..100]); # Robert Israel, Mar 28 2017
MATHEMATICA
a[1]=1; a[2]=a[3]=2; a[n_] := a[n] = a[a[n-1]-1] + a[n-a[n-2]]; Array[a, 74] (* Giovanni Resta, Mar 28 2017 *)
PROG
(PARI) a=vector(1000); a[1]=1; a[2]=a[3]=2; for(n=4, #a, a[n]=a[a[n-1]-1]+a[n-a[n-2]]); a
(Sage)
@CachedFunction
def a(n): # A284511
if (n<4): return 2 - bool(n==1)
else: return a(a(n-1)-1) + a(n-a(n-2))
[a(n) for n in (1..80)] # G. C. Greubel, Mar 28 2022
CROSSREFS
Sequence in context: A131807 A104351 A366274 * A262976 A349608 A224709
KEYWORD
nonn
AUTHOR
Altug Alkan, Mar 28 2017
STATUS
approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 26 14:37 EDT 2024. Contains 372003 sequences. (Running on oeis4.)