OFFSET
0,5
COMMENTS
LINKS
EXAMPLE
MAPLE
read transforms; # to get digsum
M:=2000;
# f(s) returns the sequence k->k+digsum(k) starting at s
f:=proc(s) global M; option remember; local n, k, s1;
s1:=[s]; k:=s;
for n from 1 to M do k:=k+digsum(k);
s1:=[op(s1), k]; od: end;
# g(s) returns (x, p), where x = first number in common between
# f(1) and f(s), and p is the position where it occurred.
# If f(1), f(s) are disjoint for M terms, returns (-1, -1)
S1:=convert(f(1), set):
g:=proc(s) global f, S1; local t1, p, S2, S3;
S2:=convert(f(s), set);
S3:= S1 intersect S2;
t1:=min(S3);
if (t1 = infinity) then RETURN(-1, -1); else
member(t1, f(s), 'p'); RETURN(t1, p-1); fi;
end;
[seq(g(n)[2], n=1..20)];
PROG
(Haskell)
import Data.Maybe (fromMaybe)
a230107 = fromMaybe (-1) . f (10^5) 1 1 1 where
f k i u j v | k <= 0 = Nothing
| u < v = f (k - 1) (i + 1) (a062028 u) j v
| u > v = f (k - 1) i u (j + 1) (a062028 v)
| otherwise = Just j
CROSSREFS
KEYWORD
sign,base
AUTHOR
N. J. A. Sloane and Reinhard Zumkeller, Oct 15 2013; corrected Oct 20 2013
STATUS
approved