OFFSET
2,2
COMMENTS
It is conjectured that all integers >= 2 appear in A217727.
PROG
(PARI) A277848(n, a=2, u=[])={for(i=1, 9e9, a==n&&return(i); u=setunion(u, [a]); while(#u>1&&u[2]==u[1]+1, u=u[^1]); my(t=log(a)\1); a=if(t>u[1]&&!setsearch(u, t), t, a^2))} \\ This code computes ("for each n") the sequence A217727 up to the index where n occurs.
(PARI) A277848_vec(N, a=2, u=[], v=vector(N))={my(i=1, t); until(u[1]>N, a<=N&&v[a]=i; u=setunion(u, [a]); while(#u>1&&u[2]==u[1]+1, u=u[^1]); i++; a=if((t=log(a)\1)>u[1]&&!setsearch(u, t), t, a^2)); v[^1]} \\ This is more efficient to compute a whole range a(1..N).
CROSSREFS
KEYWORD
nonn
AUTHOR
M. F. Hasler, Nov 20 2016
STATUS
approved