[seqfan] Re: Base sequences like A067581, suggestion: Go Factorial!

Richard Mathar mathar at strw.leidenuniv.nl
Wed Apr 1 18:37:26 CEST 2009


ak> From seqfan-bounces at list.seqfan.eu Wed Apr  1 17:30:24 2009
ak> Date: Wed, 1 Apr 2009 18:02:02 +0300
ak> From: Antti Karttunen <antti.karttunen at gmail.com>
ak> To: seqfan at list.seqfan.eu
ak> Subject: [seqfan]   Base sequences like A067581, suggestion: Go Factorial!
ak> 
ak> It might also make sense to compute a sequence like
ak> 
ak> http://www.research.att.com/~njas/sequences/A067581
ak> 
ak> in factorial base( http://www.research.att.com/~njas/sequences/A007623 ),
ak> to make the idea less dependent on any particular arbitrary base.

This variant starts
0, 1, 4, 3, 12, 9, 16, 21, 48, 33, 18, 5, 72, 11, 90, 15, 96, 17, 114, 35,
360, 39, 378, 41, 432, 57, 450, 59, 456, 63, 474, 65, 480, 23, 576, 45,
52, 81, 60, 93

with Maple style notation for the digits in list format:

0, []
1, [1]
4, [0, 2]
3, [1, 1]
12, [0, 0, 2]
9, [1, 1, 1]
16, [0, 2, 2]
21, [1, 1, 3]
48, [0, 0, 0, 2]
....
Maple program:

# convert n to factorial base; return list with least-significant digit first
fbase := proc(n)
	local nred,L,k,a ;
	nred := n ;
	L := [] ;
	k := 1 ;
	while k ! <= n do
		k := k+1 ;
	od:
	k := k-1 ;
	while k >0 do
		a := floor(nred/k!) ;
		L := [a,op(L)] ;
		nred := nred-a*k! ;
		k := k-1 ;
	od:
	L ;
end:

# return true if no common digit between x and y in factorial base
nocommd := proc(x,y)
	xd := convert(fbase(x),set) ;
	yd := convert(fbase(y),set) ;
	RETURN( xd intersect yd = {} ) ;
end:

# construct A[], the list equivalent to A067581 in factorial base, first 40 els
A := [0]; 
while nops(A) < 40 do
	for a from 1 do
		if not a in A and  nocommd(a,op(-1,A)) then
			A := [op(A),a];
			break ;
		fi;
	od:
od:
r := A ;

# visual check of result...
for i from 1 to nops(r) do
	print(op(i,r), fbase(op(i,r))) ;
od:




More information about the SeqFan mailing list