# [seqfan] Re: A158911

Rick Shepherd rlshepherd2 at gmail.com
Wed Aug 25 00:19:29 CEST 2010

```Hi Charles,

You're right, of course:  Your code is much more efficient than mine.  My
mistake.
(I was going for the it's-late-in-the-afternoon, really-naive code, which I
achieved!
I did also (subtly) suggest taking the b-file from the other seq and
subtracting 1 from each term <grin>.

Well, one better way to generate a list of terms, of course, is to calculate
(2^m)*(5^n)-1 for a "suitable" range of m and n and then to sort the
resulting terms (being careful to determine where the first missing term
should appear and only taking values less than that).  (...assuming the
sequence's comment about the form of the terms is true.).

A similar algorithm is needed to efficiently generate k-almost primes for k
http://www.research.att.com/~njas/sequences/A069272 ) through the 20-almost
primes years ago.  (I don't read Mathematica yet, but there may be some
ideas added in later programs others added there....).  I haven't looked in
the literature but I wouldn't be surprised if, for example, Knuth
addressed such algorithms many years ago.

I also like both of your new-and-improved names.  The spirit of the sequence
is that the "base" keyword is needed -- but I think one *could* argue that
not having it there (as in A003592) might be better (since some people
deliberately ignore those).  No strong feelings here.

Rick

On Tue, Aug 24, 2010 at 5:47 PM, Charles Greathouse <
charles.greathouse at case.edu> wrote:

> I certainly agree with keeping 0 in the sequence.  I omitted it
>
> The description of the sequence, if it is kept, should be rewritten
> entirely.  Perhaps
> Numbers n such that 10^n is divisible by n+1.
> or
> Numbers n such that 10^n is divisible by the number of digits in 10^n.
> depending on whether we decide that it needs the base keyword.  I
> think it needs the keyword, so I'd go for the second wording.
>
> My Pari code is significantly more efficient than Rick's.  I feel like
> there should be a better way to generate terms than testing sequential
> numbers, though.  Any ideas?
>
> Charles Greathouse
> Analyst/Programmer
> Case Western Reserve University
>
>  On Tue, Aug 24, 2010 at 5:35 PM, Rick Shepherd <rlshepherd2 at gmail.com>
> wrote:
> > Hi,
> >
> > 1) A158911(n) = A003592(n) - 1 (i.e., should be true -- by the first
> > comment in A158911 and the name of A003592).
> > 2) A003592 already has a b-file with 1000 terms.
> > 3) I also confirmed Charles' computations (through 102399) , before
> seeing
> > 1) above.
> > 4) I vote for keeping 0 in the sequence because of 1) above and because
> it
> > fits the definition.
> > 5) PARI: is(n)=(10^n)%(n+1)==0.
> > 6) I think Charles' one-liner of code had a typo (with the ^n misplaced).
> > 7) I don't understand the comments in A158911, if taken literally,
> > such as "thus
> > the sequence which gives the number of digits of K^n (written in base 10)
> is
> > periodic."  What was intended and would someone like to clarify those in
> > A158911 itself?
> > 8) Nit-picking(?):  While we're at it, how about "divided by" instead of
> > "divided thru"?
> > 9) Nit-picking:  The name of the sequence should begin with a capitalized
> > word: "Numbers"
> >
> > Regards,
> > Rick
> >
> > On Tue, Aug 24, 2010 at 4:31 PM, Claudio Meller <claudiomeller at gmail.com
> >wrote:
> >
> >> Ok, thanks Charles!
> >> Claudio
> >>
> >> 2010/8/24 Charles Greathouse <charles.greathouse at case.edu>
> >>
> >> > The sequence as written looks wrong.  I get
> >> >
> >> > 1, 3, 4, 7, 9, 15, 19, 24, 31, 39, 49, 63, 79, 99, 124, 127, 159, 199,
> >> > 249, 255, 319, 399, 499, 511, 624, 639, 799, 999, 1023, 1249, 1279,
> >> > 1599, 1999, 2047, 2499, 2559, 3124, 3199, 3999, 4095, 4999, 5119,
> >> > 6249, 6399, 7999, 8191, 9999, 10239, 12499, 12799, 15624, 15999,
> >> > 16383, 19999, 20479, 24999, 25599, 31249, 31999, 32767, 39999, 40959,
> >> > 49999, 51199, 62499, 63999, 65535, 78124, 79999, 81919, 99999, 102399,
> >> > 124999, 127999, 131071, 156249, 159999, 163839, 199999, 204799,
> >> > 249999, 255999, 262143, 312499, 319999, 327679, 390624, 399999,
> >> > 409599, 499999, 511999, 524287, 624999, 639999, 655359, 781249,
> >> > 799999, 819199, 999999, 1023999, 1048575, 1249999, 1279999, 1310719,
> >> > 1562499, 1599999, 1638399, 1953124, 1999999, 2047999, 2097151,
> >> > 2499999, 2559999, 2621439, 3124999, 3199999, 3276799, 3906249,
> >> > 3999999, 4095999, 4194303, 4999999, 5119999, 5242879, 6249999,
> >> > 6399999, 6553599, 7812499, 7999999, 8191999, 8388607, 9765624,
> >> > 9999999, ...
> >> >
> >> > with the naive
> >> >
> >> > is(n)=Mod(10,n+1)^n==0
> >> >
> >> > Charles Greathouse
> >> > Analyst/Programmer
> >> > Case Western Reserve University
> >> >
> >> > On Tue, Aug 24, 2010 at 4:05 PM, Claudio Meller <
> claudiomeller at gmail.com
> >> >
> >> > wrote:
> >> > > Hi,
> >> > >
> >> > > In http://www.research.att.com/~njas/sequences/A158911<
> >> http://www.research.att.com/%7Enjas/sequences/A158911<http://www.research.att.com/~njas/sequences/A158911>
> <http://www.research.att.com/~njas/sequences/A158911>
>  >> >
> >> > > (Numbers n such that 10^n divided thru the number of digits of 10^n
> is
> >> an
> >> > > integer.)
> >> > > are 124, 249, 299, 624, 999,1249, 1549, 2499,3999, 4999 and 7999
> terms
> >> of
> >> > > A158911?
> >> > > --
> >> > > Best
> >> > > Claudio Meller
> >> > >
> >> > > _______________________________________________
> >> > >
> >> > > Seqfan Mailing list - http://list.seqfan.eu/
> >> > >
> >> >
> >> >
> >> > _______________________________________________
> >> >
> >> > Seqfan Mailing list - http://list.seqfan.eu/
> >> >
> >>
> >>
> >>
> >> --
> >> Claudio
> >> http://grageasdefarmacia.blogspot.com
> >> http://todoanagramas.blogspot.com/
> >> http://simplementenumeros.blogspot.com/
> >>
> >> _______________________________________________
> >>
> >> Seqfan Mailing list - http://list.seqfan.eu/
> >>
> >
> > _______________________________________________
> >
> > Seqfan Mailing list - http://list.seqfan.eu/
> >
>
>
> _______________________________________________
>
> Seqfan Mailing list - http://list.seqfan.eu/
>

```