cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-7 of 7 results.

A015518 a(n) = 2*a(n-1) + 3*a(n-2), with a(0)=0, a(1)=1.

Original entry on oeis.org

0, 1, 2, 7, 20, 61, 182, 547, 1640, 4921, 14762, 44287, 132860, 398581, 1195742, 3587227, 10761680, 32285041, 96855122, 290565367, 871696100, 2615088301, 7845264902, 23535794707, 70607384120, 211822152361, 635466457082
Offset: 0

Views

Author

Keywords

Comments

Number of walks of length n between any two distinct vertices of the complete graph K_4. - Paul Barry and Emeric Deutsch, Apr 01 2004
For n >= 1, a(n) is the number of integers k, 1 <= k <= 3^(n-1), whose ternary representation ends in an even number of zeros (see A007417). - Philippe Deléham, Mar 31 2004
Form the digraph with matrix A=[0,1,1,1;1,0,1,1;1,1,0,1;1,0,1,1]. A015518(n) corresponds to the (1,3) term of A^n. - Paul Barry, Oct 02 2004
The same sequence may be obtained by the following process. Starting a priori with the fraction 1/1, the denominators of fractions built according to the rule: add top and bottom to get the new bottom, add top and 4 times the bottom to get the new top. The limit of the sequence of fractions is 2. - Cino Hilliard, Sep 25 2005
(A046717(n))^2 + (2*a(n))^2 = A046717(2n). E.g., A046717(3) = 13, 2*a(3) = 14, A046717(6) = 365. 13^2 + 14^2 = 365. - Gary W. Adamson, Jun 17 2006
For n >= 2, number of ordered partitions of n-1 into parts of sizes 1 and 2 where there are two types of 1 (singletons) and three types of 2 (twins). For example, the number of possible configurations of families of n-1 male (M) and female (F) offspring considering only single births and twins, where the birth order of M/F/pair-of-twins is considered and there are three types of twins; namely, both F, both M, or one F and one M - where birth order within a pair of twins itself is disregarded. In particular, for a(3)=7, two children could be either: (1) F, then M; (2) M, then F; (3) F,F; (4) M,M; (5) F,F twins; (6) M,M twins; or (7) M,F twins (emphasizing that birth order is irrelevant here when both/all children are the same gender and when two children are within the same pair of twins). - Rick L. Shepherd, Sep 18 2004
a(n) is prime for n = {2, 3, 5, 7, 13, 23, 43, 281, 359, ...}, where only a(2) = 2 corresponds to a prime of the form (3^k - 1)/4. All prime terms, except a(2) = 2, are the primes of the form (3^k + 1)/4. Numbers k such that (3^k + 1)/4 is prime are listed in A007658. Note that all prime terms have prime indices. Prime terms are listed in A111010. - Alexander Adamchuk, Nov 19 2006
Let A be the Hessenberg matrix of order n, defined by: A[1,j]=1, A[i,i]:=-2, A[i,i-1]=-1, and A[i,j]=0 otherwise. Then, for n>=1, a(n)=charpoly(A,1). - Milan Janjic, Jan 26 2010
Select an odd size subset S from {1,2,...,n}, then select an even size subset from S. - Geoffrey Critzer, Mar 02 2010
a(n) is the number of ternary sequences of length n where the numbers of (0's, 1's) are (even, odd) respectively, and, by symmetry, the number of such sequences where those numbers are (odd, even) respectively. A122983 covers (even, even), and A081251 covers (odd, odd). - Toby Gottfried, Apr 18 2010
An elephant sequence, see A175654. For the corner squares just one A[5] vector, with decimal value 341, leads to this sequence (without the leading 0). For the central square this vector leads to the companion sequence A046717 (without the first leading 1). - Johannes W. Meijer, Aug 15 2010
Let R be the commutative algebra resulting from adjoining the elements of the Klein four-group to the integers (equivalently, K = Z[x,y,z]/{x*y - z, y*z - x, x*z - y, x^2 - 1, y^2 - 1, z^2 - 1}). Then a(n) is equal to the coefficients of x, y, and z in the expansion of (x + y + z)^n. - Joseph E. Cooper III (easonrevant(AT)gmail.com), Nov 06 2010
Pisano period lengths: 1, 2, 2, 4, 4, 2, 6, 8, 2, 4, 10, 4, 6, 6, 4, 16, 16, 2, 18, 4, ... - R. J. Mathar, Aug 10 2012
The ratio a(n+1)/a(n) converges to 3 as n approaches infinity. - Felix P. Muga II, Mar 09 2014
This is a divisibility sequence, also the values of Chebyshev polynomials, and also the number of ways of packing a 2 X n-1 rectangle with dominoes and unit squares. - R. K. Guy, Dec 16 2016
For n>0, gcd(a(n),a(n+1))=1. - Kengbo Lu, Jul 02 2020

References

  • John Derbyshire, Prime Obsession, Joseph Henry Press, April 2004, see p. 16.

Crossrefs

a(n) = A080926(n-1) + 1 = (1/3)*A054878(n+1) = (1/3)*abs(A084567(n+1)).
First differences of A033113 and A039300.
Partial sums of A046717.
The following sequences (and others) belong to the same family: A000129, A001333, A002532, A002533, A002605, A015518, A015519, A026150, A046717, A063727, A083098, A083099, A083100, A084057.
Cf. A046717.

Programs

  • Magma
    [Round(3^n/4): n in [0..30]]; // Vincenzo Librandi, Jun 24 2011
    
  • Mathematica
    Table[(3^n-(-1)^n)/4,{n,0,30}] (* Alexander Adamchuk, Nov 19 2006 *)
  • Maxima
    a(n):= round(3^n/4)$ /* Dimitri Papadopoulos, Nov 28 2023 */
  • PARI
    a(n)=round(3^n/4)
    
  • Python
    for n in range(0, 20): print(int((3**n-(-1)**n)/4), end=', ') # Stefano Spezia, Nov 30 2018
    
  • Sage
    [round(3^n/4) for n in range(0,27)]
    

Formula

G.f.: x/((1+x)*(1-3*x)).
a(n) = (3^n - (-1)^n)/4 = floor(3^n/4 + 1/2).
a(n) = 3^(n-1) - a(n-1). - Emeric Deutsch, Apr 01 2004
E.g.f.: (exp(3*x) - exp(-x))/4. Second inverse binomial transform of (5^n-1)/4, A003463. Inverse binomial transform for powers of 4, A000302 (when preceded by 0). - Paul Barry, Mar 28 2003
a(n) = Sum_{k=0..floor(n/2)} C(n, 2k+1)*2^(2k). - Paul Barry, May 14 2003
a(n) = Sum_{k=1..n} binomial(n, k)*(-1)^(n+k)*4^(k-1). - Paul Barry, Apr 02 2003
a(n+1) = Sum_{k=0..floor(n/2)} binomial(n-k, k)*2^(n-2*k)*3^k. - Paul Barry, Jul 13 2004
a(n) = U(n-1, i/sqrt(3))(-i*sqrt(3))^(n-1), i^2=-1. - Paul Barry, Nov 17 2003
G.f.: x*(1+x)^2/(1 - 6*x^2 - 8*x^3 - 3*x^4) = x(1+x)^2/characteristic polynomial(x^4*adj(K_4)(1/x)). - Paul Barry, Feb 03 2004
a(n) = sum_{k=0..3^(n-1)} A014578(k) = -(-1)^n*A014983(n) = A051068(3^(n-1)), for n > 0. - Philippe Deléham, Mar 31 2004
E.g.f.: exp(x)*sinh(2*x)/2. - Paul Barry, Oct 02 2004
a(2*n+1) = A054880(n) + 1. - M. F. Hasler, Mar 20 2008
2*a(n) + (-1)^n = A046717(n). - M. F. Hasler, Mar 20 2008
a(n) = ((1+sqrt(4))^n - (1-sqrt(4))^n)/4. - Al Hakanson (hawkuu(AT)gmail.com), Dec 31 2008
a(n) = abs(A014983(n)). - Zerinvary Lajos, May 28 2009
a(n) = round(3^n/4). - Mircea Merca, Dec 28 2010
a(n) = Sum_{k=1,3,5,...} binomial(n,k)*2^(k-1). - Geoffrey Critzer, Mar 02 2010
From Sergei N. Gladkovskii, Jul 19 2012: (Start)
G.f.: G(0)/4 where G(k)= 1 - 1/(9^k - 3*x*81^k/(3*x*9^k - 1/(1 + 1/(3*9^k - 27*x*81^k/(9*x*9^k + 1/G(k+1)))))); (continued fraction).
E.g.f.: G(0)/4 where G(k)= 1 - 1/(9^k - 3*x*81^k/(3*x*9^k - (2*k+1)/(1 + 1/(3*9^k - 27*x*81^k/(9*x*9^k + (2*k+2)/G(k+1)))))); (continued fraction). (End)
G.f.: G(0)*x/(2*(1-x)), where G(k) = 1 + 1/(1 - x*(4*k-1)/(x*(4*k+3) - 1/G(k+1))); (continued fraction). - Sergei N. Gladkovskii, May 26 2013
a(n+1) = Sum_{k = 0..n} A238801(n,k)*2^k. - Philippe Deléham, Mar 07 2014
a(n) = (-1)^(n-1)*Sum_{k=0..n-1} A135278(n-1,k)*(-4)^k = (-1)^(n-1)*Sum_{k=0..n-1} (-3)^k. Equals (-1)^(n-1)*Phi(n,-3), where Phi is the cyclotomic polynomial when n is an odd prime. (For n > 0.) - Tom Copeland, Apr 14 2014
a(n) = 2*A006342(n-1) - n mod 2 if n > 0, a(0)=0. - Yuchun Ji, Nov 30 2018
a(n) = 2*A033113(n-2) + n mod 2 if n > 0, a(0)=0. - Yuchun Ji, Aug 16 2019
a(2*k) = 2*A002452(k), a(2*k+1) = A066443(k). - Yuchun Ji, Aug 14 2019
a(n+1) = 2*Sum_{k=0..n} a(k) if n odd, and 1 + 2*Sum_{k=0..n} a(k) if n even. - Kengbo Lu, May 30 2020
a(n) = F(n) + Sum_{k=1..(n-1)} a(k)*L(n-k), for F(n) and L(n) the Fibonacci and Lucas numbers. - Kengbo Lu and Greg Dresden, Jun 05 2020
From Kengbo Lu, Jun 11 2020: (Start)
a(n) = A002605(n) + Sum_{k = 1..n-2} a(k)*A002605(n-k-1).
a(n) = A006130(n-1) + Sum_{k = 1..n-1} a(k)*A006130(n-k-1). (End)
a(2n) = Sum_{i>=0, j>=0} binomial(n-j-1,i)*binomial(n-i-1,j)* 2^(2n-2i-2j-1)* 3^(i+j). - Kengbo Lu, Jul 02 2020
a(n) = 3*a(n-1) - (-1)^n. - Dimitri Papadopoulos, Nov 28 2023
G.f.: x/((1 + x)*(1 - 3*x)) = Sum_{n >= 0} x^(n+1) * Product_{k = 1..n} (k + 3*x + 1)(1 + k*x) (a telescoping series). Cf. A007482. - Peter Bala, May 08 2024
From Peter Bala, Jun 29 2025: (Start)
For n >= 1, a(n+1) = 2^n * hypergeom([1/2 - (1/2)*n, -(1/2)*n], [-n], -3).
G.f. A(x) = x*exp(Sum_{n >= 1} a(2*n)/a(n)*x^n/n) = x + 2*x^2 + 7*x^3 + 20*x^4 + ....
sqrt(A(x)/x) is the g.f. of A002426.
The following series telescope:
Sum_{n >= 1} (-3)^n/(a(n)*a(n+1)) = -1; Sum_{n >= 1} (-3)^n/(a(n)*a(n+1)*a(n+2)*a(n+3)) = -1/98.
In general, for k >= 0, Sum_{n >= 1} (-3)^n/(a(n)*a(n+1)*...*a(n+2*k+1)) = -1/((a(1)*a(2)*...*a(2*k+1))*a(2*k+1)).
Sum_{n >= 1} 3^n/(a(n)*a(n+1)*a(n+2)) = 1/4; Sum_{n >= 1} 3^n/(a(n)*a(n+1)*a(n+2)* a(n+3)*a(n+4)) = 1/5600.
In general, for k >= 1, Sum_{n >= 1} 3^n/(a(n)*a(n+1)*...*a(n+2*k)) = 1/((a(1)*a(2)*...*a(2*k))*a(2*k)). (End)

Extensions

More terms from Emeric Deutsch, Apr 01 2004
Edited by Ralf Stephan, Aug 30 2004

A000224 Number of squares mod n.

Original entry on oeis.org

1, 2, 2, 2, 3, 4, 4, 3, 4, 6, 6, 4, 7, 8, 6, 4, 9, 8, 10, 6, 8, 12, 12, 6, 11, 14, 11, 8, 15, 12, 16, 7, 12, 18, 12, 8, 19, 20, 14, 9, 21, 16, 22, 12, 12, 24, 24, 8, 22, 22, 18, 14, 27, 22, 18, 12, 20, 30, 30, 12, 31, 32, 16, 12, 21, 24, 34, 18, 24, 24, 36, 12
Offset: 1

Views

Author

Keywords

Comments

For any n > 2, there are quadratic nonresidues mod n, so a(n) < n. - Charles R Greathouse IV, Oct 28 2022
Conjecture: n^2 == 1 (mod a(n)*(a(n)-1)) if and only if n is an odd prime. - Thomas Ordowski, Apr 13 2025
This conjecture holds at least up to n = 10^8. - Michel Marcus, Apr 13 2025

Examples

			The sequence of squares (A000290) modulo 10 reads 0, 1, 4, 9, 6, 5, 6, 9, 4, 1, 0, 1, 4, 9, 6, 5, 6, 9, 4, 1,... and this reduced sequence contains a(10) = 6 different values, {0,1,4,5,6,9}. - _R. J. Mathar_, Oct 10 2014
		

Crossrefs

Cf. A095972, A046530 (cubic residues), A052273 (4th powers), A052274 (5th powers), A052275 (6th powers), A085310 (7th powers), A085311 (8th powers), A085312 (9th powers), A085313 (10th powers), A085314 (11th powers), A228849 (12th powers).

Programs

  • Haskell
    a000224 n = product $ zipWith f (a027748_row n) (a124010_row n) where
       f 2 e = 2 ^ e `div` 6 + 2
       f p e = p ^ (e + 1) `div` (2 * p + 2) + 1
    -- Reinhard Zumkeller, Aug 01 2012
    
  • Maple
    A000224 := proc(m)
        {seq( modp(b^2,m),b=0..m-1) };
        nops(%) ;
    end proc: # Emeric Deutsch
    # 2nd implementation
    A000224 := proc(n)
        local a,ifs,f,p,e,c ;
        a := 1 ;
        ifs := ifactors(n)[2] ;
        for f in ifs do
            p := op(1,f) ;
            e := op(2,f) ;
            if p = 2 then
                if type(e,'odd') then
                    a := a*(2^(e-1)+5)/3 ;
                else
                    a := a*(2^(e-1)+4)/3 ;
                end if;
            else
                if type(e,'odd') then
                    c := 2*p+1 ;
                else
                    c := p+2 ;
                end if;
                a := a*(p^(e+1)+c)/2/(p+1) ;
            end if;
        end do:
        a ;
    end proc: # R. J. Mathar, Oct 10 2014
  • Mathematica
    Length[Union[#]]& /@ Table[Mod[k^2, n], {n, 65}, {k, n}] (* Jean-François Alcover, Aug 30 2011 *)
    a[2] = 2; a[n_] := a[n] = Switch[fi = FactorInteger[n], {{, 1}}, (fi[[1, 1]] + 1)/2, {{2, }}, 3/2 + 2^fi[[1, 2]]/6 + (-1)^(fi[[1, 2]]+1)/6, {{, }}, {p, k} = fi[[1]]; 3/4 + (p-1)*(-1)^(k+1)/(4*(p+1)) + p^(k+1)/(2*(p+1)), , Times @@ Table[ a[Power @@ f], {f, fi}]]; Table[a[n], {n, 1, 100}] (* _Jean-François Alcover, Mar 09 2015 *)
  • PARI
    a(n) = local(v,i); v = vector(n,i,0); for(i=0, floor(n/2),v[i^2%n+1] = 1); sum(i=1,n,v[i]) \\ Franklin T. Adams-Watters, Nov 05 2006
    
  • PARI
    a(n)=my(f=factor(n));prod(i=1,#f[,1],if(f[i,1]==2,2^f[1,2]\6+2,f[i,1]^(f[i,2]+1)\(2*f[i,1]+2)+1)) \\ Charles R Greathouse IV, Jul 15 2011
    
  • Python
    from math import prod
    from sympy import factorint
    def A000224(n): return prod((p**(e+1)//((p+1)*(q:=1+(p==2)))>>1)+q for p, e in factorint(n).items()) # Chai Wah Wu, Oct 07 2024

Formula

a(n) = A105612(n) + 1.
Multiplicative with a(p^e) = floor(p^e/6) + 2 if p = 2; floor(p^(e+1)/(2p + 2)) + 1 if p > 2. - David W. Wilson, Aug 01 2001
a(2^n) = A023105(n). a(3^n) = A039300(n). a(5^n) = A039302(n). a(7^n) = A039304(n). - R. J. Mathar, Sep 28 2017
Sum_{k=1..n} a(k) ~ c * n^2/sqrt(log(n)), where c = (17/(32*sqrt(Pi))) * Product_{p prime} (1 - (p^2+2)/(2*(p^2+1)*(p+1))) * (1-1/p)^(-1/2) = 0.37672933209687137604... (Finch and Sebah, 2006). - Amiram Eldar, Oct 18 2022
If p is an odd prime, then a(p) = (p + 1)/2. - Thomas Ordowski, Apr 09 2025

A033113 Base-3 digits are, in order, the first n terms of the periodic sequence with initial period 1,0.

Original entry on oeis.org

1, 3, 10, 30, 91, 273, 820, 2460, 7381, 22143, 66430, 199290, 597871, 1793613, 5380840, 16142520, 48427561, 145282683, 435848050, 1307544150, 3922632451, 11767897353, 35303692060, 105911076180, 317733228541, 953199685623
Offset: 1

Views

Author

Keywords

Comments

Written in base 3, this yields A056830. - M. F. Hasler, Oct 05 2018

Crossrefs

Programs

  • Magma
    [Round(3^(n+1)/8): n in [1..30]]; // Vincenzo Librandi, Jun 25 2011
  • Maple
    a[0]:=0: a[1]:=1: for n from 2 to 50 do a[n]:=2*a[n-1]+3*a[n-2]+1 od: seq(a[n], n=1..33);# Zerinvary Lajos, Dec 14 2008
    g:=x*(1/(1-3*x)/(1-x))/(1+x): gser:=series(g, x=0, 43): seq(coeff(gser, x, n), n=1..30);# Zerinvary Lajos, Jan 11 2009
    A033113 := proc(n) (9*3^(n-1)-(-1)^n-2)/8 ; end proc: # R. J. Mathar, Jan 08 2011
  • Mathematica
    Join[{a=1,b=3},Table[c=2*b+3*a+1;a=b;b=c,{n,60}]] (* Vladimir Joseph Stephan Orlovsky, Feb 01 2011 *)
    Module[{nn=30,d},d=PadRight[{},nn,{1,0}];Table[FromDigits[Take[d,n],3],{n,nn}]] (* or *) LinearRecurrence[{3,1,-3},{1,3,10},30] (* Harvey P. Dale, May 24 2014 *)
  • PARI
    a(n)=3^n*3\8 \\ Simplified by M. F. Hasler, Oct 06 2018
    
  • PARI
    A033113(n)=3^(n+1)>>3 \\ M. F. Hasler, Oct 05 2018
    

Formula

a(n) = A039300(n)-1.
a(n)+a(n+1) = A003462(n+1).
a(n) = 3*a(n-1) + a(n-2) -3*a(n-3). - R. J. Mathar, Jun 28 2010
From Paul Barry, Nov 12 2003: (Start)
G.f.: x/((1-x)*(1+x)*(1-3*x)).
a(n) = 2*a(n-1) + 3*a(n-2) + 1.
Partial sums of A015518. (End)
E.g.f.: (1/2)*exp(x)*(sinh(x))^2. - Paul Barry, Mar 12 2003
a(n) = Sum_{k=0..floor(n/2)} C(n+2, 2k+2)*4^k. - Paul Barry, Aug 24 2003
a(n) = Sum_{k=0..floor(n/2)} 3^(n-2*k); a(n) = Sum_{k=0..n} Sum_{j=0..k} (-1)^(j+k)*3^j. - Paul Barry, Nov 12 2003
Convolution of A000244 and A059841 (3^n and periodic{1, 0}). a(n) = Sum_{k=0..n} (1 + (-1)^(n-k))*3^k/2. - Paul Barry, Jul 19 2004
a(n) = round(3^(n+1)/8) = floor((3^(n+1)-1)/8) = ceiling((3^(n+1)-3)/8) = round((3^(n+1)-3)/8). a(n) = a(n-2) + 3^(n-1), n > 2. - Mircea Merca, Dec 27 2010
a(n) = floor((3^(n+1))/4) / 2 = A081251(n)/2, n >= 1. - Wolfdieter Lang, Apr 13 2012

A000993 Number of distinct quadratic residues mod 10^n; also number of distinct n-digit endings of base-10 squares.

Original entry on oeis.org

1, 6, 22, 159, 1044, 9121, 78132, 748719, 7161484, 70800861, 699869892, 6978353179, 69580078524, 695292156201, 6947835288052, 69465637212039, 694529215501164, 6944974263529141, 69446563720728612, 694457689921141299, 6944497426351013404
Offset: 0

Views

Author

Keywords

Examples

			Any square ends with one of 0, 1, 4, 5, 6, 9, so a(1) = 6.
A square may end with 22 different two-digit combinations: 00, 01, 04, 09, 16, 21, 24, 25, 29, 36, 41, 44, 49, 56, 61, 64, 69, 76, 81, 84, 89, 96. E.g., no number ending with 14 can be square, etc. See also A075821, A075823.
The finite sequence A122986 has a(3) = 159 terms. - _Reinhard Zumkeller_, Mar 21 2010
		

References

  • Albert H. Beiler, Recreations in the Theory of Numbers, Dover Publ., 2nd Ed., NY, 1966, Chapter XV, 'On The Square', p. 139.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Magma
    [1] cat [(83 + 27*(-1)^n + 9*2^(1 + n) + (-1)^n*2^(2 + n) + 9*5^(2 + n) + (-1)^n*5^(2 + n) + 2^(1 + n)*5^(2 + n))/ 72: n in [0..20]]; // Vincenzo Librandi, Mar 29 2012
    
  • Maple
    -(-6+38*z+241*z^2-594*z^3-1285*z^4+1600*z^5+1500*z^6)/((-1+z)*(5*z-1)*(2*z+1)*(2*z-1)*(5*z+1)*(10*z-1)*(z+1)); #  Bruno Salvy
  • Mathematica
    a[n_] := (83 - 27*(-1)^n + 9*2^(n) - (-1)^n*2^(1 + n) + 9*5^(1 + n) - (-1)^n*5^(1 + n) + 2^(n)*5^(1 + n))/72; Table[ Floor[ a[n]], {n, 0, 20}]
    (* Or *) a[0] = 1; a[1] = 6; a[2] = 22; a[3] = 159; a[4] = 1044; a[5] = 9121; a[6] = 78132; a[7] = 748719; a[8] = 7161484; a[n_] := 130 a[n - 2] - 3129 a[n - 4] + 13000 a[n - 6] - 10000 a[n - 8]; Table[ a[n], {n, 0, 20}]
    (* Or *) CoefficientList[ Series[(1 - 4*x - 68*x^2 + 59*x^3 + 723*x^4 - 5*x^5 - 1700*x^6 - 500*x^7)/(1 - 10*x - 30*x^2 + 300*x^3 + 129*x^4 - 1290*x^5 - 100*x^6 + 1000*x^7), {x, 0, 20}], x] (* Robert G. Wilson v, Nov 27 2004 *)
    LinearRecurrence[{10,30,-300,-129,1290,100,-1000},{1,6,22,159,1044,9121,78132,748719},20] (* Harvey P. Dale, Dec 17 2017 *)
  • Python
    print([(2 + 2**n // 6) * (1 + 5**(n+1) // 12) if n else 1 for n in range(21)]) # Nick Hobson, Mar 10 2024

Formula

a(n) = floor( (83 - (-1)^n*(27 + 2^(n+1) + 5^(n+1)) + 9*2^n + (9 + 2^n)*5^(n+1)) / 72 ).
a(n+8) = 130 a(n+6) - 3129 a(n+4) + 13000 a(n+2) - 10000 a(n) for n >= 1.
G.f.: (1 - 4*x - 68*x^2 + 59*x^3 + 723*x^4 - 5*x^5 - 1700*x^6 - 500*x^7)/(1 - 10*x - 30*x^2 + 300*x^3 + 129*x^4 - 1290*x^5 - 100*x^6 + 1000*x^7).

A039306 Number of distinct quadratic residues mod 9^n.

Original entry on oeis.org

1, 4, 31, 274, 2461, 22144, 199291, 1793614, 16142521, 145282684, 1307544151, 11767897354, 105911076181, 953199685624, 8578797170611, 77209174535494, 694882570819441, 6253943137374964, 56285488236374671, 506569394127372034
Offset: 0

Views

Author

Keywords

Comments

Number of distinct n-digit suffixes of base 9 squares.
From Danny Rorabaugh, Dec 15 2015: (Start)
Construct the word y_n as follows: y_0 = a; y_{n+1} is three concatenated copies of y_n, except that the middle copy is written with letters not used in y_n. For example:
y_0 = a;
y_1 = aba;
y_2 = abacdcaba;
y_3 = abacdcabaefeghgefeabacdcaba.
a(n) is the number of nonempty subwords of y_n that occur as a subword exactly once.
Let s(n, k) be the number of subwords of y_n that occur exactly 2^k times. One can show that s(n, 0) = a(n) using s(n+1, k+1) = s(n, k) + s(n, k+1), binomial(3^n+1, 2) = Sum_{k=0..n) s(n, k)*2^k, and the formulas for a(n) below.
(End)

Examples

			From _Danny Rorabaugh_, Dec 15 2015: (Start)
The squares of the numbers 0..8 are [0, 1, 4, 9, 16, 25, 36, 49, 64]. Modulo 9, these are [0, 1, 4, 0, 7, 7, 0, 4, 1]. Thus there are a(1) = 4 distinct quadratic residues module 9^1 = 9: 0, 1, 4, and 7.
There are a(2) = 31 subwords of y_2 = abacdcaba which occur in y_2 exactly once: [abac, abacd, abacdc, abacdca, abacdcab, abacdcaba, bac, bacd, bacdc, bacdca, bacdcab, bacdcaba, ac, acd, acdc, acdca, acdcab, acdcaba, cd, cdc, cdca, cdcab, cdcaba, d, dc, dca, dcab, dcaba, ca, cab, caba].
(End)
		

Crossrefs

Quadratic residues modulo k^n: A023105 (k=2), A039300 (k=3), A039301 (k=4), A039302 (k=5), A039303 (k=6), A039304 (k=7), A039305 (k=8), this sequence (k=9), A000993 (k=10).

Programs

  • Magma
    I:=[1, 4, 31]; [n le 3 select I[n] else 9*Self(n-1)+Self(n-2)-9*Self(n-3): n in [1..30]]; // Vincenzo Librandi, Apr 22 2012
  • Mathematica
    CoefficientList[Series[(1-6*x)/((1-x)*(1-9*x)),{x,0,30}],x] (* Vincenzo Librandi, Apr 22 2012 *)

Formula

a(n) = floor((9^n+3)*3/8).
G.f.: (1-6*x)/((1-x)*(1-9*x)). - _Colin Barker, Mar 14 2012
a(n) = 9*a(n-1) +a(n-2) -9*a(n-3). - Vincenzo Librandi, Apr 22 2012
a(n) = (5+3^(2n+1))/8 = a(n-1) + 3^(2n-1). - Danny Rorabaugh, Dec 15 2015

A367484 Number of integers of the form (x^4 + y^4) mod 3^n; a(n) = A289559(3^n).

Original entry on oeis.org

1, 3, 7, 19, 55, 165, 493, 1477, 4429, 13287, 39859, 119575, 358723, 1076169, 3228505, 9685513, 29056537
Offset: 0

Views

Author

Albert Mukovskiy, Nov 19 2023

Keywords

Comments

It appears that for n > 4: a(n) = 2*3^(n-1) + a(n-4).
For n < 5: a(n) = 2*3^(n-1) + 1.
Conjecture in closed form: a(n) = 2*ceiling(3^(n+3)/80) - 1.

Crossrefs

Subsequence of A289559.

Programs

  • PARI
    a(n) = #setbinop((x, y)->Mod(x,3^n)^4+Mod(y,3^n)^4, [0..3^n-1]);
    
  • Python
    def A367484(n):
        m = 3**n
        return len({(pow(x,4,m)+pow(y,4,m))%m for x in range(m) for y in range(x+1)}) # Chai Wah Wu, Jan 23 2024

Formula

Conjecture: a(n) = 2*ceiling(3^(n+3)/80) - 1.
a(n) = A289559(3^n). - Thomas Scheuerle, Nov 20 2023

A368415 Array read by ascending antidiagonals. A(n, k) = floor((n^k + 3)*(n/(2*n + 2))).

Original entry on oeis.org

1, 1, 1, 2, 2, 1, 2, 4, 3, 1, 3, 7, 11, 6, 1, 3, 11, 26, 31, 11, 1, 4, 16, 53, 103, 92, 22, 1, 4, 22, 93, 261, 410, 274, 43, 1, 5, 29, 151, 556, 1303, 1639, 821, 86, 1, 5, 37, 228, 1051, 3333, 6511, 6554, 2461, 171, 1, 6, 46, 329, 1821, 7354, 19996, 32553, 26215, 7382, 342, 1, 6, 56, 455, 2953
Offset: 1

Views

Author

Thomas Scheuerle, Dec 23 2023

Keywords

Comments

Let p be an odd prime number, then A(p, k) is the number of distinct quadratic residues mod p^k. Let m = p1^k1^*p2^k2*..*pz^kz with p1..pz odd primes, then A(p1, k1)*A(p2, k2)*..*A(pz, kz) is the number of distinct quadratic residues mod m. For 2^t*m is floor((2^t+10)*(1/6))*A(p1, k1)*A(p2, k2)*..*A(pz, kz) the number of distinct quadratic residues mod 2^t*m.

Examples

			The array A(n, k) begins:
1,  1,   1,    1,     1,      1,       1,        1,         1,          1
1,  2,   3,    6,    11,     22,      43,       86,       171,        342
2,  4,  11,   31,    92,    274,     821,     2461,      7382,      22144
2,  7,  26,  103,   410,   1639,    6554,    26215,    104858,     419431
3, 11,  53,  261,  1303,   6511,   32553,   162761,    813803,    4069011
3, 16,  93,  556,  3333,  19996,  119973,   719836,   4319013,   25914076
4, 22, 151, 1051,  7354,  51472,  360301,  2522101,  17654704,  123582922
4, 29, 228, 1821, 14564, 116509,  932068,  7456541,  59652324,  477218589
5, 37, 323, 2953, 26573, 239149, 2152337, 19371025, 174339221, 1569052981
5, 46, 455, 4546, 45455, 454546, 4545455, 45454546, 454545455, 4545454546
		

Crossrefs

Programs

  • PARI
    A(n, k) = (n^(k+1)+n*3)\(2*n+2)

Formula

A(n, k) = n*A(n, k-1) + A(n, k-2) - n*A(n, k-3), for k > 2 and A(n, 0) = 1.
A(1, k) = 1.
A(2, k) = A005578(k).
A(3, k) = A039300(k).
A(4, k) = A363773(k).
A(5, k) = A039302(k).
A(7, k) = A039304(k).
A(8, k) = A172241(k+1)+1.
A(n, 2) = A000124(n-1), for n > 0.
Showing 1-7 of 7 results.