%I #32 Jul 20 2018 22:27:52
%S 0,0,0,1,0,0,1,0,0,1,0,1,1,0,0,1,2,0,2,0,0,1,0,1,1,0,6,1,0,0,1,2,0,1,
%T 0,0,1,3,0,1,0,3,1,0,1,1,3,0,1,0,0,7,0,0,1,0,5,2,2,1,3,1,0,1,0,1,1,0,
%U 0,3,13,9,1,0,0,1,8,0,5,3,0,1,0,1,1,0,2
%N a(n) = number of iterations needed to stabilize the map m -> f(m) where f(m) is the concatenation in descending order of the prime distinct divisors of the numbers m = 2n+1, or = -1 if there is no such a(n).
%C Let f denote the map that replaces n by the concatenation of its prime divisors, written in decreasing order, each divisor being written in base 10 in the normal way. Then a(n) is the number of iterations needed to reach either a prime number or stabilize until a last composite number of a repetitive cycle (see the second example) when starting at 2n+1 and iterating f.
%C It seems that a(222) is unknown.
%H Michel Lagneau, <a href="/A237584/b237584.txt">Table of n, a(n) for n = 1..221</a>
%H Michel Lagneau, <a href="/A237584/a237584.txt">Table of n, a(n) for n = 1..400</a>, with a(n)=-1 when unknown.
%e a(57) = 5 because 2*57+1 = 115 -> 235 -> 475 -> 195 -> 1353 -> 41113 with 5 iterations, where the prime divisors of 115 in descending order are {23, 5} => 235, the prime divisors of 235 in descending order are {47, 5} => 475, the prime divisors of 475 in descending order are {19, 5} => 195, the prime divisors of 195 in descending order are {13,5,3} => 1353, and the prime divisors of 1353 are {41,11,3} => 41113 is prime and the last member of the trajectory.
%e a(1561)= 3 because 2*1561+1 = 3123 -> 3473 -> 15123 -> 713 with 3 iterations because 713 -> 3123 is already in the trajectory.
%p with(numtheory):for m from 1 to 500 do:n:=2*m+1:lst:={n}:nn:=n:for it from 1 to 10^4 while(type(nn,prime)=false) do:x:=factorset(nn):n1:=nops(x): s:=sum('x[n1-i+1]*10^(sum('length(x[n1-j+1])', 'j'=i+1..n1))', 'i'=1..n1):lst:=lst union {s}:nn:=s:od:n2:=nops(lst)-1: printf(`%d, `,n2):od:
%o (PARI) cmap(n) = {v = []; nb = 0; ok = 0; if (isprime(n), return (nb)); while (!ok, nb++; s = ""; f = factor(n); for (k=1, #f~, s = concat(Str(f[k,1]), s)); new = eval(s); if (isprime(new), return (nb)); if (already(new, v), return(nb)); v = concat(v, new); n = new;);}
%o a(n) = cmap(2*n+1); \\ _Michel Marcus_, Sep 27 2015
%K sign,base
%O 1,17
%A _Michel Lagneau_, Feb 09 2014
%E Previous b-file transformed into an auxiliary file and new b-file restricted to known values by _Michel Marcus_, Sep 27 2015
|