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!)
A317127 a(0) = a(1) = a(2) = 1; for n >= 3, a(n) = freq(a(n-1),n) + freq(a(n-3),n) where freq(i, j) is the number of times i appears in the terms a(0) .. a(j-1). 2

%I #29 Jul 16 2024 04:19:42

%S 1,1,1,6,4,4,3,3,4,5,3,6,3,8,3,10,2,6,4,5,5,7,4,8,3,11,3,14,2,9,2,6,5,

%T 7,6,9,4,11,4,14,4,16,3,16,4,17,3,18,2,13,2,10,3,15,3,22,2,17,3,18,4,

%U 22,4,22,6,17,6,14,6,16,6,18,6,20,4,22,5,17,8,8,8,10,8,12,4,19,2,20,3,20,6,24,4

%N a(0) = a(1) = a(2) = 1; for n >= 3, a(n) = freq(a(n-1),n) + freq(a(n-3),n) where freq(i, j) is the number of times i appears in the terms a(0) .. a(j-1).

%C Inspired by A316774.

%C In this sequence, it is obvious that we have exactly three 1’s that are a(0) = a(1) = a(2) = 1. Can we determine the frequency characteristics of some other positive integers? For example, are there infinitely many 2's in this sequence?

%H Antti Karttunen, <a href="/A317127/b317127.txt">Table of n, a(n) for n = 0..65537</a>

%H Altug Alkan, <a href="/A317127/a317127.png">A line graph of a(n) for n <= 500</a>

%p b:= proc() 0 end:

%p a:= proc(n) option remember; local t;

%p t:= `if`(n<3, 1, b(a(n-1))+b(a(n-3)));

%p b(t):= b(t)+1; t

%p end:

%p seq(a(n), n=0..100); # after _Alois P. Heinz_ at A316774

%t c = <||>; f[n_] := If[KeyExistsQ[c,n],c[n],0]; a[n_] := a[n] = Block[{v}, v = If[n<3, 1, f[a[n-1]] + f[a[n-3]]]; If[f[v]>0, c[v] = c[v]+1, c[v]=1]; v]; Array[a, 93, 0] (* _Giovanni Resta_, Jul 24 2018 *)

%o (PARI)

%o up_to = 5000;

%o listA317127off1(up_to) = { my(v = vector(up_to),c); v[1] = v[2] = v[3] = 1; for(n=4,up_to, c=0; for(k=1,(n-1), c += ((v[k]==v[n-1])+(v[k]==v[n-3]))); v[n] = c); (v); };

%o listA317127off1(up_to) = { my(v = vector(up_to), m = Map(), c); v[1] = v[2] = v[3] = 1; mapput(m, 1, 3); for(n=4,up_to, c = (mapget(m, v[n-1])+mapget(m,v[n-3])); v[n] = c; mapput(m, c, if(!mapisdefined(m, c), 1, 1+mapget(m, c)))); (v); }; \\ Faster!

%o v317127 = listA317127off1(1+up_to);

%o A317127(n) = v317127[1+n]; \\ _Antti Karttunen_, Jul 23 2018

%Y Cf. A316774.

%K nonn,look,changed

%O 0,4

%A _Altug Alkan_, Jul 21 2018

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 July 27 22:08 EDT 2024. Contains 374651 sequences. (Running on oeis4.)