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”).

A350562
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) = (n-m+1)*a(n); otherwise a(n+1) = 1. Start with a(1)=1 and a(2)=0.
0
1, 0, 1, 3, 1, 3, 9, 1, 4, 1, 3, 18, 1, 4, 24, 1, 4, 16, 1, 4, 16, 64, 1, 5, 1, 3, 48, 1, 4, 40, 1, 4, 16, 208, 1, 5, 65, 1, 4, 32, 1, 4, 16, 176, 1, 5, 55, 1, 4, 32, 352, 1, 5, 40, 1000, 1, 5, 25, 1, 4, 48, 1680, 1, 5, 40, 480, 1, 5, 25, 300, 1, 5, 25, 125, 1
OFFSET
1,4
COMMENTS
A type of multiplicative Van Eck sequence.
MATHEMATICA
f[1]=1; f[n_]:=0; f2[n_]:=0; a[n_]:=Block[{q=f2[x]}, If[q!=0, s[n]=((n-1-q)*(x))+x, s[n]=1]]; s[1]=1; s[2]=0; x=0; Do[x=a[n]; f2[x]=f[x]; f[x]=n, {n, 3, 100000}]; data=Table[s[n], {n, 1, 100000}]
PROG
(PARI) findm(list, n) = {forstep (m=n-1, 1, -1, if (list[m] == list[n], return(m))); return(0); }
lista(nn) = {my(list = List([1, 0])); for (n=3, nn, my(m=findm(list, n-1)); if (m, listput(list, (n-m)*list[n-1]), listput(list, 1)); ); Vec(list); } \\ Michel Marcus, Jan 17 2022
(Python)
from itertools import count, islice
def A350562_gen(): # generator of terms
bdict = {1:1}
yield 1
b = 0
for n in count(3):
yield b
c = (n-bdict[b])*b if b in bdict else 1
bdict[b], b = n-1, c
A350562_list = list(islice(A350562_gen(), 30)) # Chai Wah Wu, Feb 11 2022
CROSSREFS
Sequence in context: A143453 A376499 A248830 * A164308 A082511 A265307
KEYWORD
nonn
AUTHOR
Jasmine Miller, Jan 05 2022
STATUS
approved