# tips (examples - long message)

N. J. A. Sloane njas at research.att.com
Sun Apr 2 21:29:24 CEST 2006

```PS to my last "tips" message.

I would like to show you three examples of what I consider

I hope the authors (Vladeta Jovovic,
Stefan Steinerberger and Michael Somos) will forgive me for
reproducing their messages.  The first two were sent in via the form,
Michael's came in a direct email.

If everyone would follow one of these styles my life would
be a lot easier (and updates would happen quicker and more accurately).

Of course many other people do so already - I have just picked out
three examples.

Neil

%I A055603
%S A055603 0, 1, 90, 2248, 43000, 755100, 13003620, 226262400, 4037765760, 74481120000
%N A055603 Number of n X n binary matrices with no zero rows or columns and with n+2 ones.
%F A055603 a(n) = n*(n-1)*(9*n^4+42*n^3+7*n^2-122*n-120)*n!/576.
%Y A055603 Cf. A055602.
%K A055603 ,nonn,

Stefan gives the extended sequence, and a comment (to me) saying
what he is doing:

%I A100110
%S A100110 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 32, 33, 35, 37, 41, 43, 47, 49, 53, 59, 52,
53, 55, 57, 61, 63, 67, 69, 73, 79, 72, 73, 75, 77, 81, 83, 87, 89, 93, 99, 112,
113, 115, 117, 121, 123, 127, 129, 133, 139, 132, 133, 135, 137, 141, 143, 147,
149, 153, 159, 172, 173, 175, 177, 181, 183, 187, 189, 193, 199, 192
%C A100110 More terms ("more" can be deleted) + code.
%t A100110 Table[FromDigits[Prime[(IntegerDigits[n] + 1)]], {n, 0, 70}]
%K A100110 ,nonn,
%A A100110 Stefan Steinerberger (stefan.steinerberger at gmail.com), Mar 27 2006

Michael has adopted what I consider to be the best format of all.

He composes an email message to me.
First, background,
then a message to me listing any lines to be deleted or replaced
then the new or corrected lines for each sequence
(always prefixed by the %I lines)
then documenation of his calculations
then dated versions of the sequences he is commenting on.
(this obviates the need for reproducing the %S and %N lines
if they are not going to be chnaged_
(this is also helpful in case the sequence has changed
in the mean time)

From: "Michael Somos"
Subject: COMMENT EIS: A001190,A065653,A072191,A102847

[To make my point better, I have changed this message.  The data here
is no longer correct.  This is just an example.  - njas]
Mar 25 2006
Neil Sloane,

This is for A001190,A065653,A072191,A102847.

*replace* "%Y A065653 Cf. A102847." with better info.

I suggest :

%% BEG
-------------------------------------------------------------------------------
%I A001190 M0790 N0298
%o A001190 (PARI) {a(n)=local(A); if(n<4, n>0, A=vector(n, i, 1); for(i=4, n, A[i]=sum(j=1, (i-1)\2, A[j]*A[i-j])+if(i%2, 0, A[i/2]*(A[i/2]+1)/2)); A[n])} /* Michael Somos Mar 25 2006 */
-------------------------------------------------------------------------------
%I A065653
%S A065653 1,1,2,3,5,7,11,15,22,30,42,56,76,100,133,172,225,288,371,470,598,751,
%T A065653 945,1177,1468,1815,2245,2757,3386,4133,5043,6121,7425,8966,10818,13001,
%U A065653 15610,18677,22324,26600,31662,37582,44560,52701,62261,73387,86406
%F A065653 A102847(n)=a(2n+1), A072191(n)=a(2n).
%o A065653 (PARI) a(n)=if(n<2, n>0, 2+a(n-2)^2) /* Michael Somos Mar 25 2006 */
-------------------------------------------------------------------------------
%I A072191
%o A072191 (PARI) a(n)=if(n<1, 0, 2+a(n-1)^2) /* Michael Somos Mar 25 2006 */
-------------------------------------------------------------------------------
%I A102847
%o A102847 (PARI) a(n)=if(n<1, n==0, 2+a(n-1)^2) /* Michael Somos Mar 25 2006 */
-------------------------------------------------------------------------------
%% END

My work :

-------------------------------------------------------------------------------
/* This PARI-GP code is for sequence A001190 */
ID="A001190";
OFF=0;
NEW=0;
/* define the sequence function */
{a(n)=local(A,m); if(n<1, 0, A=O(x); m=1; while(m<=n, m*=2;
A=1-sqrt(1-2*x-subst(A,x,x^2))); polcoeff(A, n))}

/* alternate definition of sequence function */
{b(n)=local(A); if(n<4, n>0, A=vector(n, i, 1); for(i=4, n,
A[i]=sum(j=1, (i-1)\2, A[j]*A[i-j])+if(i%2, 0, A[i/2]*(A[i/2]+1)/2)
); A[n])}

/* check equality of definitions */
oo=100;  \\ our infinity
print(prod(n=0,oo,a(n)==b(n)));

/*
? oo=100;  \\ our infinity
? print(prod(n=0,oo,a(n)==b(n)));
1
*/
-------------------------------------------------------------------------------
/* This PARI-GP code is for sequence A065653 */
ID="A065653";
OFF=0;
NEW=0;
/* define the sequence function */
a(n)=if(n<2, n>0, 2+a(n-2)^2)
-------------------------------------------------------------------------------
/* This PARI-GP code is for sequence A072191 */
ID="A072191";
OFF=0;
NEW=0;
/* define the sequence function */
a(n)=if(n<1, 0, 2+a(n-1)^2)

/* print the sequence entries offset 0 */
printe(7,8,9);

/*
? printe(7,8,9);
%K A072191 nonn
%O A072191 0,2
%S A072191 0,2,6,38,1446,2090918,4371938082726,19113842599189892819591078,
%T A072191 365338978906606237729724396156395693696687137202086,
%U A072191 133472569508521677503139972517335009022889462418844369330479463819154657319297609174034202576402751398
*/
-------------------------------------------------------------------------------
/* This PARI-GP code is for sequence A102847 */
ID="A102847";
OFF=0;
NEW=0;
/* define the sequence function */
a(n) = if(n<1, n==0, 2+a(n-1)^2)

/* print the sequence entries offset 0 */
printe(6,7,8);

/*
? printe(6,7,8);
%K A102847 nonn
%O A102847 0,2
%S A102847 1,3,11,123,15131,228947163,52416803445748571,
%T A102847 2747521283470239265968814548542043,
%U A102847 7548873203121950871924356140057489033996373873303512592376938613851
*/
-------------------------------------------------------------------------------

Shalom, Michael

EIS Sat Mar 25 06:27:53 2006 UTC
===============================================================================
%I A001190 M0790 N0298
%S A001190 0,1,1,1,2,3,6,11,23,46,98,207,451,983,2179,4850,10905,24631,56011,
%T A001190 127912,293547,676157,1563372,3626149,8436379,19680277,46026618,
%U A001190 107890609,253450711,596572387,1406818759,3323236238,7862958391
%N A001190 Wedderburn-Etherington numbers: binary rooted trees (every node has out-degree 0 or 2) with n endpoints (and 2n-1 nodes in all).
%C A001190 Also n-node binary rooted trees (every node has out-degree <= 2) where root has degree 0 or 1.
%C A001190 Number of interpretations of x^n (or number of ways to insert parentheses) when multiplication is commutative but not associative. E.g. a(4) = 2: x(x.x^2) and x^2.x^2. a(5) = 3: (x.x^2)x^2, x(x.x.x^2) and x(x^2.x^2).
%C A001190 Number of ways to place n stars in a single bound stable hierarchical multiple star system; i.e. taking only the configurations from A003214 where all stars are included in single outer parentheses. - Piet Hut, Nov 07 2003
%D A001190 L. Comtet, Advanced Combinatorics, Reidel, 1974, p. 55.
%D A001190 S. J. Cyvin et al., Enumeration of constitutional isomers of polyenes, J. Molec. Structure (Theochem), 357 (1995), 255-261.
%D A001190 I. M. H. Etherington, Non-associate powers and a functional equation, Math. Gaz. 21 (1937), 36-39 and 153.
%D A001190 I. M. H. Etherington, On non-associative combinations, Proc. Royal Soc. Edinburgh, 59 (Part 2, 1938-39), 153-162.
%D A001190 S. R. Finch, Mathematical Constants, Cambridge, 2003, pp. 295-316.
%D A001190 J. N. Franklin and S. W. Golomb, A Function-Theoretic Approach to the Study of Nonlinear Recurring Sequences, Pacific J. Math., Vol. 56, p. 467, 1975.
%D A001190 C. D. Olds, Problem 4277, Amer. Math. Monthly, 56 (1949), 697-699.
%D A001190 R. P. Stanley, Enumerative Combinatorics, Cambridge, Vol. 2, 1999; see Problem 6.52.
%D A001190 J. H. M. Wedderburn, The functional equation g(x^2) = 2ax + [ g(x) ]^2, Ann. Math., 24 (1922-23), 121-140.
%D A001190 F. Murtagh, "Counting dendrograms: a survey", Discrete Applied Mathematics, 7 (1984), 191-199.
%H A001190 H. Bottomley, [1]Illustration of initial terms
%H A001190 P. J. Cameron, [2]Sequences realized by oligomorphic permutation groups, J. Integ. Seqs. Vol. 3 (2000), #00.1.5.
%H A001190 Steven Finch, [3]Otter's Tree Enumeration Constants
%H A001190 INRIA Algorithms Project, [5]Encyclopedia of Combinatorial Structures 43
%H A001190 INRIA Algorithms Project, [6]Encyclopedia of Combinatorial Structures 45
%H A001190 Eric Weisstein's World of Mathematics, [7]Weakly Binary Tree
%H A001190 Eric Weisstein's World of Mathematics, [8]Strongly Binary Tree
%H A001190 [9]Index entries for "core" sequences
%H A001190 [10]Index entries for sequences related to rooted trees
%H A001190 [11]Index entries for sequences related to trees
%H A001190 [12]Index entries for sequences related to parenthesizing
%F A001190 G.f.: A(x) = x + (1/2)*(A(x)^2 + A(x^2)).
%F A001190 G.f. A(x)=1-sqrt(1-2x-A(x^2)) satisfies A(x)^2-2*A(x)+2x+A(x^2)=0, A(0)=0. - Michael Somos, Sep 06 2003
%F A001190 a(2n-1)=a(1)a(2n-2)+a(2)a(2n-3)+...+a(n-1)a(n), a(2n)=a(1)a(2n-1)+a(2)a(2n-2)+...+a(n-1)a(n+1)+a(n)(a(n)+1)/2.
%p A001190 A001190 := proc(n) option remember; local s,k; if n<=1 then RETURN(n); elif n <=3 then RETURN(1); else s := 0; if n mod 2 = 0 then s := A001190(n/2)*(A001190(n/2)+1)/2; for k from 1 to n/2-1 do s := s+A001190(k)*A001190(n-k); od; RETURN(s); else for k from 1 to (n-1)/2 do s := s+A001190(k)*A001190(n-k); od; RETURN(s); fi; fi; end;
%p A001190 N := 40: G001190 := add(A001190(n)*x^n,n=0..N);
%p A001190 spec := [S,{S=Union(Z,Prod(Z,Set(S,card=2)))},unlabeled]: seq(combstruct[count](spec, size=n), n=0..20);
%o A001190 (PARI) a(n)=local(A,m); if(n<0,0,m=1; A=O(x); while(m<=n,m*=2; A=1-sqrt(1-2*x-subst(A,x,x^2))); polcoeff(A,n))
%Y A001190 Cf. A000108, A001699, A002658, A006894, A003214, A088325.
%K A001190 easy,core,nonn,nice,eigen
%O A001190 0,5
%A A001190 njas
===============================================================================

References

1. http://www.research.att.com/~njas/sequences/a001190.gif
2. http://www.cs.uwaterloo.ca/journals/JIS/index.html
3. http://pauillac.inria.fr/algo/bsolve/constant/otter/otter.html
4. http://www.sns.ias.edu/~piet/
5. http://algo.inria.fr/bin/encyclopedia?Search=ECSnb&argsearch=43
6. http://algo.inria.fr/bin/encyclopedia?Search=ECSnb&argsearch=45
7. http://mathworld.wolfram.com/WeaklyBinaryTree.html
8. http://mathworld.wolfram.com/StronglyBinaryTree.html
9. http://www.research.att.com/~njas/sequences/Sindx_Cor.html#core
10. http://www.research.att.com/~njas/sequences/Sindx_Ro.html#rooted
11. http://www.research.att.com/~njas/sequences/Sindx_Tra.html#trees
12. http://www.research.att.com/~njas/sequences/Sindx_Par.html#parens

EIS Sat Mar 25 07:49:14 2006 UTC
===============================================================================
%I A065653
%S A065653 0,1,2,3,6,11,38,123,1446,15131,2090918,228947163,4371938082726,
%T A065653 52416803445748571,19113842599189892819591078,
%U A065653 2747521283470239265968814548542043
%N A065653 a(0) = 0, a(1) = 1, a(n) = a(n-2)*a(n-2) + 2 for n > 1.
%Y A065653 A065652
%Y A065653 Cf. A102847.
%K A065653 nonn
%O A065653 0,3
%A A065653 Reinhard Zumkeller (reinhard.zumkeller(AT)lhsystems.com), Nov 10 2001
===============================================================================

EIS Sat Mar 25 06:23:03 2006 UTC
===============================================================================
%I A072191
%S A072191 0,2,6,38,1446,2090918,4371938082726,19113842599189892819591078,
%T A072191 365338978906606237729724396156395693696687137202086,
%U A072191 133472569508521677503139972517335009022889462418844369330479463819154657319297609174034202576402751398
%N A072191 a(n)=a(n-1)^2+2.
%H A072191 Eric Weisstein's World of Mathematics, [1]Weakly Binary Tree
%e A072191 0^2+2=2, 2^2+2=6, 6^2+2=38 ...
%t A072191 Table[ a[n], {n, 0, 10}]
%Y A072191 Cf. A003095.
%K A072191 easy,nonn
%O A072191 0,2
%A A072191 Miklos Kristof (kristmikl(AT)freemail.hu), Jul 02 2002
%E A072191 Edited by Robert G. Wilson v (rgwv(AT)rgwv.com), Jul 03 2002
===============================================================================

References

1. http://mathworld.wolfram.com/WeaklyBinaryTree.html

EIS Sat Mar 25 07:50:52 2006 UTC
===============================================================================
%I A102847
%S A102847 1,3,11,123,15131,228947163,52416803445748571,
%T A102847 2747521283470239265968814548542043,
%U A102847 7548873203121950871924356140057489033996373873303512592376938613851
%N A102847 a(0)=1, a(n)=a(n-1)*a(n-1)+2.
%C A102847 The Mandelbrot-process is z:=z*z+c, where z and c is complex. In our case c=2 and the initial z is 1. The process is very quickly increasing.
%C A102847 Prime for a(1)=3, a(2)=11, a(4)=15131; semiprime for a(3) = 123 = 3 * 41, a(5) = 228947163 = 3 * 76315721. a(6), added by Jonathan Vos Post, has 4 prime factors. a(7) = 41 * 811^2 * 106693969 * 317171188688357726699 * 8272236925540996054440172449761. When is the next prime in the sequence? - Jonathan Vos Post (jvospost2(AT)yahoo.com), Feb 28 2005
%e A102847 a(2)=11, a(3)=11*11+2=123
%p A102847 a[0]:=1: for n from 1 to 10 do a[n]:=a[n-1]^2+2 od: seq(a[n],n=0..9); (Deutsch)
%Y A102847 Bisection of A065653.
%K A102847 easy,nonn
%O A102847 0,2
%A A102847 Miklos Kristof (kristmikl(AT)freemail.hu), Feb 28 2005
%E A102847 a(7) from Jonathan Vos Post (jvospost2(AT)yahoo.com), Feb 28 2005
%E A102847 a(8) from Emeric Deutsch (deutsch(AT)duke.poly.edu), Jun 13 2005
===============================================================================

```