

A089725


Let f(n) = (2n+1), g(n) = (n1)/2. Then a(n) = f(f(f(...(n)))), where one gets prime at every step. If f(n) is not a prime then a(n) = g(g(g...(n)))) where one gets a prime at every step. If f(n) and g(n) both are composite then a(n) = 0.


0



7, 47, 7, 0, 47, 13, 3, 17, 19, 0, 47, 0, 0, 59, 31, 0, 0, 37, 0, 167, 43, 0, 47, 0, 0, 107, 13, 0, 59, 61, 0, 0, 67, 0, 71, 73, 0, 0, 79, 0, 167, 0, 0, 2879, 0, 0, 2, 97, 0, 101, 103, 0, 107, 109, 0, 227, 0, 0, 29, 0, 0, 0, 127, 0, 263, 0, 0, 137, 139, 0, 0, 0, 0, 149, 151, 0, 0, 157, 0
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,1


LINKS

Table of n, a(n) for n=1..79.


EXAMPLE

a(2) = 47 as f(f(f(f(2)))) = 47. a(7) = 3 as f(7) = 15 but g(7) = 3.
a(4) = 0 as f(4) = 4*2+1 = 9 is composite and (41)/2 is non integer.


MAPLE

f:=n>2*n+1: g:=n>(n1)/2: for n from 1 to 100 do mf:=f(n): mg:=g(n): if isprime(mf) then while isprime(f(mf)) do mf:=f(mf) od: printf("%d, ", mf) elif n mod 2= 1 and isprime(mg) then while mg mod 2=1 and isprime(g(mg)) do mg:=g(mg) od: printf("%d, ", mg) else printf("%d, ", 0) fi od: # C. Ronaldo


CROSSREFS

Sequence in context: A000823 A036944 A068640 * A086040 A009241 A263920
Adjacent sequences: A089722 A089723 A089724 * A089726 A089727 A089728


KEYWORD

nonn


AUTHOR

Amarnath Murthy, Nov 18 2003


EXTENSIONS

More terms from C. Ronaldo (aga_new_ac(AT)hotmail.com), Dec 26 2004


STATUS

approved



