This formula is from my technical notes database, generates a sequentially increasing number using a computed when composed field on the form so user can see the number but it is only fixed when you save the document.
T_List:=@DbColumn("" : "NoCache"; ""; "RefNumView"; 1);
@If(@IsNewDoc & @Elements(T_List)=0;1;@IsNewDoc & !@IsError(T_List);@Subset(T_List;1) + 1;RefNumber)
You need a view first column sorted in descending order with the field that stores your number, if the view has no records the code above starts numbering at 1
The database was developed in Notes 4.5 but I'm still using it now with 8.5 notes client & designer and have never needed to change the formula, indeed its been reused many times over the years in all the later versions. It won't work if documents are created on multiple servers, for that the scheduled agent is the only way to get a truly unique sequential numbering.