login
A381229
a(n) is the number of distinct positive integers that can be obtained by starting with n, and optionally applying the operations square root, floor, and ceiling, in any order.
3
1, 2, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 4, 6, 6, 6, 6, 6, 6, 6, 6, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 7, 7, 7, 7, 7, 7
OFFSET
1,2
EXAMPLE
For n = 15, sqrt(15) = 3.872..., floor and ceiling give 3 and 4. Sqrt(3) = 1.732..., and floor and ceiling give 1 and 2. 4 gives nothing new. In all, we get a(15) = 5 different numbers: 15, 3, 4, 1, 2.
PROG
(PARI) f(n) = my(t); if(n<4, [1..n], t=sqrtint(n); if(issquare(n), concat(f(t), n), Set(concat([f(t), f(t+1), [n]]))));
a(n) = #f(n);
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane and Jinyuan Wang, Feb 25 2025
STATUS
approved