[seqfan] Re: Sequence A056815

RGWv rgwv at rgwv.com
Fri Jan 27 15:09:39 CET 2012


Emmanuel is correct in his observation and solution. But the following is 
just a bit "cleaner".
LookAndSayA[n_]  := FromDigits@ Flatten@ IntegerDigits@ Flatten[ 
Through[{Length, First}[#]] & /@ Split@ IntegerDigits@ n]
Bob.

-----Original Message----- 
From: Emmanuel Vantieghem
Sent: Thursday, January 26, 2012 3:57 PM
To: seqfan at list.seqfan.eu
Subject: [seqfan] Sequence A056815

Dear Sir,



This concerns sequence  A056815 <http://oeis.org/A056815>  at the OEIS.



The Mathematica program sounds as follows :

LookAndSayA[n_]:=FromDigits at Flatten@((Through[{Length,First}[
#]]&)/@Split at IntegerDigits@n);Select[Prime at Range[210], 
PrimeQ at LookAndSayA@#&].


The output of the program is correct, but errors will happen if one runs it
for numbers with digits that are repeated more than 10 times.

Example.  If we replace

             Prime at Range[210]

by

      Prime at Range[712142837439,712142837440]

the output is

             {21111111111121},

which would mean that the sequence A056815 contains the prime p =
21111111111121.

However, the exact 'look and say' value of  p  is  121111211, which is not
prime.  Thus, A056815 does not contain the prime  p !

The reason is that the value returned by the function LookAndSayA at p
is 13111211,
which is not correct.

The program could be repaired as follows (b and c to be substituted by
suitable numbers) :

LookAndSayA[n_]:=FromDigits at Flatten@(IntegerDigits/@Flatten@
((Through[{Length,First}[#]]&)/@Split at IntegerDigits@n));W=Select[Prime at Range
[b,c],PrimeQ at LookAndSayA@#&].


Sincere greetings.

Emmanuel Vantieghem.

_______________________________________________

Seqfan Mailing list - http://list.seqfan.eu/ 




More information about the SeqFan mailing list