%I #36 Nov 30 2020 08:51:28
%S 1,2,4,8,16,32,64,128,256,512,1023,2045,4088,8172,16336,32656,65280,
%T 130496,260864,521473,1042434,2083846,4165649,8327214,16646264,
%U 33276208,66519792,132974368,265818368,531376129,1062231296,2123421181,4244760561,8485359561,16962400080,33908170232,67783096912
%N Number of strings of Hebrew letters with a gematria value equal to n.
%C A051596-restricted compositions of n.
%H Robert Israel, <a href="/A339073/b339073.txt">Table of n, a(n) for n = 1..3300</a>
%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Gematria">Gematria</a>
%F From _Doron Zeilberger_, Nov 23 2020: (Start)
%F G.f.: Sum(a(n)*x^n, n=0..infinity) =
%F 1/(1-add(x^i,i=1..9)-add(x^(10*i),i=1..9)-add(x^(100*i),i=1..4))
%F = 1/(1-x-...-x^9 - x^10- ... -x^90 - x^100-x^200-x^300-x^400).
%F Asymptotics:
%F a(n) ~ 0.50221591060212746248115807725009875743325273964521...*(1.9990196005347377028156443471636402056440270173905...)^n
%F If alpha is the smallest positive root of P:=1-x-...-x^9 - x^10- ... -x^90 - x^100-x^200-x^300-x^400=0
%F then the above asymptotic formula is exactly -(alpha*P'(alpha))* (1/alpha)^n.
%F (End)
%e The four strings with a gematria of 3 are:
%e אאא (111)
%e אב (12)
%e בא (21)
%e ג (3)
%e Note: Hebrew is written right-to-left, which is why the order of the digits appears to be reversed.
%p g:= 1/(1-add(x^i,i=1..9)-add(x^(10*i),i=1..9)-add(x^(100*i),i=1..4)):
%p S:= series(g,x,101):
%p seq(coeff(S,x,n),n=1..100); # _Robert Israel_, Nov 25 2020
%t Table[SeriesCoefficient[1/(1 - Sum[x^j, {j, Join[Range[9], 10 Range[9], 100 Range[4]]}]), {x, 0, n}], {n, 100}] (* _Jan Mangaldan_, Nov 27 2020 *)
%o (C#)int[] gematrias = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 200, 300, 400 };
%o char[] letters = { 'א', 'ב', 'ג', 'ד', 'ה', 'ו', 'ז', 'ח', 'ט', 'י', 'כ', 'ל', 'מ', 'נ', 'ס', 'ע', 'פ', 'צ', 'ק', 'ר', 'ש', 'ת' };
%o //Calculates a(n) when you call CountStrings(n), and populates ListOfStrings with the list of valid strings that have gematria equal to n.
%o int CountStrings (int leftover, string stringOfLetters = "")
%o {
%o int count = 0;
%o foreach (int value in gematrias)
%o {
%o string secondString = "";
%o if (value == leftover)
%o {
%o count++;
%o secondString += letters[Array.IndexOf(gematrias, value)];
%o ListOfStrings.Items.Add(stringOfLetters + secondString);
%o }
%o else if (value < leftover)
%o {
%o secondString += letters[Array.IndexOf(gematrias, value)];
%o count += CountStrings(leftover-value,stringOfLetters + secondString);
%o }
%o }
%o return count;
%o }
%Y Cf. A051596, A000079.
%K nonn,word
%O 1,2
%A _Daniel Sterman_, Nov 22 2020
%E More terms from _Robert Israel_, Nov 25 2020
|