[seqfan] Re: Rank of a prime (Collatz/Syracuse)

Richard Mathar mathar at strw.leidenuniv.nl
Mon Feb 9 14:03:16 CET 2009


njas> From seqfan-bounces at list.seqfan.eu Mon Feb  9 06:25:30 2009
njas> Date: Mon, 9 Feb 2009 00:16:55 -0500
njas> From: "N. J. A. Sloane" <njas at research.att.com>
njas> To: eric.angelini at kntv.be, jacques.tramu at echolalie.com, keynews.tv at skynet.be,
njas>         seqfan at seqfan.eu
njas> Cc: njas at research.att.com
njas> Subject: [seqfan] Re: Rank of a prime (Collatz/Syracuse)
njas> ...
njas> 
njas> %I A098282
njas> %S A098282 1,2,3,6,4,31,7,56,4,34,5
njas> %N A098282 Iterate the map k -> A087712(k) starting at n; a(n) is the number of steps at which we see a repeated term for the first time; or -1 if the trajectory never repeats.
....

I think Jacques' nomenclature is one off, ie, counts the items in the trajectory
including the first duplicate. I get

1, 2, 3, 6, 4, 31, 7, 55, 4, 33, 5, 30, 32, 1, 4, 19, 8, ">39", 56, 16,
27, 4, 4, 26, 2, 20, ">29", ">29", 34, 14, 6, 100, 2, 9, 10, 75, 31, ">40"

where the entries for a(18) and a(27), a(28) etc mean my Maple gets stuck in
factorizing some of the associated integers, so these are either larger than
the numbers indicated or (less likely) -1.


cat2 := proc(a,b)
	a*10^(max(1,ilog10(b)+1))+b ;
end:
A049084 := proc(p)
	if isprime(p) then
		numtheory[pi](p) ;
	else
		0 ;
	fi;
end:
A087712 := proc(n)
	local pf,a,p,ex ;
	if isprime(n) then
		A049084(n) ;
	elif n = 1 then
		1 ;
	else
		pf := ifactors(n)[2] ;
		a := 0 ;
		for p in pf do
			for ex from 1 to op(2,p) do
				a := cat2(a, A049084(op(1,p)) ) ;
			od:
		od:
	fi;
end:

A098282 := proc(n)
	local traj,img ;
	traj := {n} ;
	img := n ;
	while true do
		img := A087712(img) ;
		if img in traj then
			RETURN(nops(traj)) ;
		else
			traj := traj union {img} ;
		fi;
	od;
end:
for n from 1 do
	printf("%d,\n", A098282(n) ) ;
od:




More information about the SeqFan mailing list