\\ ---- PARI/GP program for A352957 ----- \\ Peter Munn, May 2022 \\ ----------Abbreviations used---------- \\ gpf = Greatest Prime Factor \\ IvLog = Integer-valued Logarithm \\ Ix = Index \\ No = Number \\ Seq = Sequence \\ Workg = Working T(UpperLimit, BFileNeeded) = { my (SeqIx, gpf = vector(UpperLimit), WorkgIx, gpfOfWorkgIx, AdditiveValue, PrimeToRemap); forfactored (FactoredNo = 2, UpperLimit, gpf[FactoredNo[1]] = FactoredNo[2][omega(FactoredNo),1] ); for (RowLength = 1, UpperLimit, my (IvLog = vector(RowLength)); WorkgIx = 1; IvLog[1] = 0; while (WorkgIx < RowLength, WorkgIx++; gpfOfWorkgIx = gpf[WorkgIx]; IvLog[WorkgIx] = IvLog[WorkgIx-1] + RowLength\WorkgIx; AdditiveValue = IvLog[gpfOfWorkgIx] + IvLog[WorkgIx\gpfOfWorkgIx]; if (IvLog[WorkgIx] > AdditiveValue, PrimeToRemap = max(gpfOfWorkgIx, precprime(sqrt(WorkgIx)-1)); \\ with the above line as "PrimeToRemap = gpfOfWorkgIx", the program miscalculates at row 483. while (IvLog[PrimeToRemap]+1 == IvLog[PrimeToRemap+1], \\ increasing IvLog[PrimeToRemap] would remove strict monotonicity PrimeToRemap = precprime(PrimeToRemap) ); IvLog[PrimeToRemap]++; while (WorkgIx > PrimeToRemap, IvLog[WorkgIx] = 0; WorkgIx--), \\ else if (IvLog[WorkgIx] < AdditiveValue, IvLog[WorkgIx] = AdditiveValue) ) ); \\ end while -- row with RowLength has been calculated if (BFileNeeded, for (WorkgIx = 1, RowLength, print (SeqIx++, " ", IvLog[WorkgIx])), \\ else print (IvLog) ); ) \\ end of for, running through the rows }