Nothing Special   »   [go: up one dir, main page]

login
A274425
Consider van Eck's sequences with a(1)=n and a(2)=0. Sequence lists the index of second occurrence of n.
2
4, 6, 21, 18, 13, 11, 67, 48, 25, 149, 45, 174, 122, 31, 36, 139, 42, 64, 90, 57, 106, 325, 102, 216, 111, 258, 143, 321, 226, 472, 73, 60, 82, 184, 540, 135, 93, 264, 169, 130, 549, 53, 200, 180, 229, 99, 298, 622, 671, 358, 157, 117, 1487, 476, 1478, 85, 513
OFFSET
1,1
LINKS
FORMULA
a(n) = 1 + A171862(n). - Jan Ritsema van Eck, Jul 24 2019
EXAMPLE
Starting with a(1)=1 and a(2)=0 the second occurrence of 1 is for a(4):
1, 0, 0, 1, 3, 0, 3, 2, 0, 3, 3, 1, 8, 0, 5, 0, 2, 9, 0, 3, 9, 3, 2, ...
Starting with a(1)=2 and a(2)=0 the second occurrence of 2 is for a(6):
2, 0, 0, 1, 0, 2, 5, 0, 3, 0, 2, 5, 5, 1, 10, 0, 6, 0, 2, 8, 0, 3, 13, ...
Starting with a(1)=3 and a(2)=0 the second occurrence of 3 is for a(21):
3, 0, 0, 1, 0, 2, 0, 2, 2, 1, 6, 0, 5, 0, 2, 6, 5, 4, 0, 5, 3, 20, 0, ...
MAPLE
P:=proc(q) local a, c, h, i, k, m, n, p, x; m:=60000; a:=Array(1..m); p:=Array(0..m, -1); c:=Array(0..1000);
for k from 0 to 1000 do for i from 0 to m do p[i]:=0; od; for i from 1 to m do a[i]:=0; od;
a[1]:=k; a[2]:=0; p[0]:=2; p[a[1]]:=1; x:=0; for n from 3 to m do h:=p[x]; a[n]:=x; p[x]:=n; x:=0;
if h>0 then x:=n-h; fi; if a[n]=k then c[k]:=x+1; break; fi;
od; od; [seq(c[n], n=0..1000)]; end: P(1);
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Paolo P. Lava, Jul 13 2016
STATUS
approved