OFFSET
1,4
COMMENTS
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..65537
FORMULA
EXAMPLE
The directed acyclic graph whose unique root is 153 (illustrated below), spans the following seven numbers [1, 5, 17, 25, 51, 75, 153], as A032742(153) = 51, A302042(153) = 75, A032742(51) = 17, A302042(51) = 25, A032742(75) = 25, A302042(75) = 15, A032742(25) = A302042(25) = 5, and A032742(17) = A302042(17) = A032742(5) = A302042(5) = 1. We exclude the root 153 from the count of numbers that are reached, thus a(153) = 6. (Equally, we can include 153, but exclude 1).
.
153
/ \
/ \
51 75
/ \ / \
/ 17 \
\ | /
\ 1 /
\ /
\ /
25
|
5
|
1
PROG
(PARI)
up_to = 65537;
ordinal_transform(invec) = { my(om = Map(), outvec = vector(length(invec)), pt); for(i=1, length(invec), if(mapisdefined(om, invec[i]), pt = mapget(om, invec[i]), pt = 0); outvec[i] = (1+pt); mapput(om, invec[i], (1+pt))); outvec; };
v078898 = ordinal_transform(vector(up_to, n, A020639(n)));
A078898(n) = v078898[n];
A302042(n) = if((1==n)||isprime(n), 1, my(c = A078898(n), p = prime(-1+primepi(A020639(n))+primepi(A020639(c))), d = A078898(c), k=0); while(d, k++; if((1==k)||(A020639(k)>=p), d -= 1)); (k*p));
A326189aux(n, distvals) = if(1==n, distvals, my(newdistvals=setunion([n], distvals), a=A032742(n), b=A302042(n)); newdistvals = A326189aux(a, newdistvals); if(a==b, newdistvals, A326189aux(b, newdistvals)));
A326189(n) = length(A326189aux(n, Set([])));
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Aug 23 2019
STATUS
approved