[seqfan] Re: help needed with sequences related to Kaprekar map

zak seidov zakseidov at yahoo.com
Wed Aug 19 21:21:25 CEST 2009

```Yes,
62964 is OK:
62964->71973->83952->74943->62964
but 61974 is smaller (and the smallest!)
61974->82962->75933->63954->61974
I used Mathematica.
Zak

--- On Wed, 8/19/09, Richard Mathar <mathar at strw.leidenuniv.nl> wrote:

> From: Richard Mathar <mathar at strw.leidenuniv.nl>
> Subject: [seqfan] Re: help needed with sequences related to Kaprekar map
> To: seqfan at seqfan.eu
> Date: Wednesday, August 19, 2009, 3:14 PM
>
> A151959(4) is 61974 (or smaller), not 62964 as currently
> listed:
>      from the map 10026 -> 61974
> -> 82962 -> 75933 -> 63954
> The 62964 is in a cycle of length 4 as observed, but 61974
> is just smaller.
>
> The offset in A151959 should be changed to 1.
>
>
> In Maple 9:
>
> A151949 := proc(n)
>     tdigs := convert(n,base,10) ;
>         tup := sort(tdigs) ;
> *10^(i-1),i=1..nops(tup)) :
> end:
>
> N := 10 :
> allc := [seq(10000000000000000000000000000000,i=1..N)] :
>
> cyK := proc(n,)
>     global allc,N ;
>     L := [n] ;
>     k := n ;
>     while true do
>         k := A151949(k) ;
>         if k in L then
>
> for s from 1 do
>
>     if op(-s,L) = k then
>
>         cur := op(s,allc) ;
>
>         if k < cur then
>
>
> printf("%a %d %d\n",L,s,k) ;
>
>
>
>
> allc := subsop(s=k,allc) ;
>
>         fi;
>
>         RETURN(s) ;
>
>     fi;
>
> od:
>
> break;
>         fi;
>         L := [op(L),k] :
>     od:
> end:
>
> for n from 1 do
>     cyK(n) ;
> od:
>
>
> _______________________________________________
>
> Seqfan Mailing list - http://list.seqfan.eu/
>

```