A230626 Iterate the map x -> A230625(x) starting at n; sequence gives number of steps to reach a prime, or -1 if no prime is ever reached.
0, 0, 3, 0, 1, 0, 1, 2, 2, 0, 1, 0, 1, 1, 4, 0, 4, 0, 3, 1, 1, 0, 1, 2, 4, 2, 3, 0, 2, 0, 2, 1, 5, 1, 7, 0, 1, 1, 2, 0, 2, 0, 2, 3, 3, 0, 1, 3, 3, 1, 1, 0, 1, 3, 2, 6, 2, 0, 1, 0, 2, 2, 2, 2, 3, 0, 1, 2, 6, 0, 2, 0, 4, 4, 3, 2, 2, 0, 4, 4, 3, 0, 5, 2, 2, 2, 3
Offset: 2
Examples
Starting at 18: 18 = 2*3^2 = 10*11^10 in binary -> 101110 = 46 = 2*23 = 10*10111 -> 1010111 = 87 = 3*29 = 11*11101 -> 1111101 = 125 = 5^3 = 101^11 -> 10111 = 23, prime, taking 4 steps, so a(18) = 4.
Links
- Sean A. Irvine, Table of n, a(n) for n = 2..10000 (terms 2..3931 from Chai Wah Wu)
Programs
-
Mathematica
fn[n_] := FromDigits[Flatten[IntegerDigits[ReplaceAll[FactorInteger[n], {x_, 1} -> {x}], 2]], 2]; Map[Length, Table[NestWhileList[fn, n, # != 1 && ! PrimeQ[#] &], {n, 2, 40}], {1}] - 1 (* Robert Price, Mar 16 2020 *)
Extensions
More terms from Chai Wah Wu, Jul 15 2014
Comments