finding if first number

cino hilliard hillcino368 at hotmail.com
Sun May 28 17:28:13 CEST 2006


Thanks Neil and Russ for your work.

I like the graph page. The listen is to much work for me. But it is a good 
idea.

I noticed a lot of requests for "goodies" and I have not chimed in yet. 
Actually, you can copy and
paste the list into excel or your favorite application to get extra 
features. This is what I have
been doing. Moreover you can call the sequence list from excel or other 
programs with a little
programming.

Maybe some day we will have an encyclopedia of real numbers, this way we can 
get smooth
graphs.


cino wrote:
> > I went through the docs and found no way of doing a first entry only 
>search.

Neil wrote:
>Go to the Welcome page and scroll down. There is section
>where you can see the whole database broken up
>into chunks, and arranged in lexicographic order
   "Most are arranged in  lexicographic order..."
>using the second offset.

With all due respect, I know all this.

I downloaded the 119 parts using the small basic programs at the end and  
came up with this
output with the seqfindfirst routine also at the end.

find string 911
%S A093634 911,911111,911111111111111111111,
This 911 was found in Part 114
%S A003854 911666827031785075278550369566720000,
This 911 was found in Part 119
%S A003847 911666827031785075278550369566720000,
This 911 was found in Part 119
It took  4.6875 to find the 3 first occurrence(s) of 911
find string 910 (no blank space)
%S A102503 
910109,913139,916169,917179,920209,923239,928289,931319,935359,937379
This 910 was found in Part 117
It took  4.6875 to find the 1 first occurrence(s) of 910

find string 910 (with a blank space)
It took  4.6875 to find the 0 first occurrence(s) of 910
find string 910,
It took  4.75 to find the 0 first occurrence(s) of 910,
find string

>There is a unique place where you will find all
>the sequences that begin 911, right after
>those that begin 910, etc.

This I assume you mean 700's,800's 900's as 910 is not a first entry. 
However, it does not always
follow and I have to manually search. The 911 was an example prelude  to 
"more" that I would like
to see.

If I were looking for the occurrence of the first three characters 911 which 
could are prepended
to other bigger integers, we span parts 114 to 119. A formidible task indeed 
to browse in
Explorer.

>
>That is the main reason why the OEIS is sorted this way,
>so there's a unique place to look if you know the start
>of the sequence.

Yes, I could take a guess that part 114  has 726 as a start maybe that is it 
and then do the
browser find whole word 911,. Now if you are lucky you won't skip over it as 
I did twice.
But say I had 100 numbers I wanted to search for first occurrence?

For example, suppose one is superstitious and wants to find ALL sequences 
that start with the
integer 13. Try that with the browser Find in the welcome part numbers.  
Here are a few with
the total. Here we span 500 sequences from part 94 to part 119.

%S A073867 
13,0,17,0,19,0,59,0,79,0,389,0,499,0,997,1889,0,1999,0,6899,0,17989,
This 13 was found in Part 94
%S A010227 13,1,1,1,1,26,1,1,1,1,26,1,1,1,1,26,1,1,1,1,26,1,1,1,1,
This 13 was found in Part 94
...
...
%S A087594 
13,29,31,41,47,53,61,79,83,97,103,113,163,227,229,331,347,367,401,449
This 13, was found in Part 95
...
...
%S A119488 
13,23,41,83,103,89,103,113,227,229,547,373,419,263,373,787,419,433,593,
This 13, was found in Part 119
It took  5.625 to find the 505 first occurrence(s) of 13,

If you relax this and seek just the first 2 characters 13, then you will get 
a total count of 735.

Clearly, this search would not be possible to do accurately, browsing the 
database in the
welcome page.

Interestingly, there are no sequences that begin with 13 (blank),  only with 
13 or 13,.

Also, It is interesting that many numbers are not a sequence starter. Maybe 
someone has
done a sequence on this.

For example, 1207 (Pearl Harbor), does not start a sequence. 1207  as a 
prefix does however,
produce:

%S A038131 
120777781,111210471811,311211101417111821,13211231101114111731181211,
This 1207 was found in Part 118
It took  5.75 to find the 1 first occurrence(s) of 1207

I computed the following short lived sequence from this discussion using the 
program. For integers
0, to 17, the following first integer occurrences are out there as of last 
night's data.
   0        1         2      3       4      5      6      7      8     9    
10   11    12   13  14   15  16   17
19456,56199,10790,5438,2992,2417,1574,1410,958,982,697,1030,542,505,299,394,357,400
Lets call this the vanishing sequence.

Conclusion
-------------------
My question was a preamble to a reality I want to come: Findfirst, 
findsecond find_Nth. finding
second occurrences was also on my mind but I did not want to scuttle the 
request with too
much desire at once.

Have Fun,

Sequentially yours,
Cino hilliard.


   *************Code to find first seq with select first  
integer****************
   ****You must extract or copy and paste from welcome into a file 
*************
dim j,s$,a$,find$,t!,c,part$,partf$,fil$,s1$
dim ln%
print "               Find first occurrence of an integer in oeis"
find$ = " "
while find$ <> ""
line input "find str ",find$
t=timer
c=0
ln = len(find$)
fil$ = find$&".txt"
open fil$ for output as fp2
open "052706.txt" for input as fp1  'download this file with extractseq.bas
if find$ ="" then exit
Rewind(fp1)
while not eof(fp1)
  line input fp1,s$
  j=instr(s$,"        The Database of Integer Sequences, Part")
  if j = 1 then  'Keep track of the latest part number to used later
  part$=mid$(s$,44)
  goto cont
  end if
  a$ = left$(s$,2)
  s1$ = mid$(s$,12,ln)
  if a$ = "%S"  then         'check for first offset
  if s1$ = find$ then        'check for find
  partf$=part$              'save the part that applies
  print s$                  'and print it if it is
  print "This ";find$;" was found in ";partf$
  fprint fp2,s$
  fprint fp2,"This ";find$;" was found in ";partf$
  c++
  end if
  end if
cont:
wend
print " It took ";timer-t;" to find the";c;" first occurrence(s) of ";find$
fprint fp2," It took ";timer-t;" to find the";c;" first occurrence(s) of 
";find$
close fp1
close fp2
wend


**************************The extract program ********************
cls
$nowin
print "  Bcx file extractseq.bas extracts the integer sequence Parts to a 
file."
print "                    By Cino hilliard Aug 17, 2004"
...
...   Omitted for security reasons

print "It took ";t2!-t1!;" sec to extract Parts ";start;" to ";fin;" to file 
";fil$;"."
print "Press Enter to exit ..."
getchar()







More information about the SeqFan mailing list