Thin-film-synthesis algorithm for realization of refractive indices and Airy summation