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-10 of 98 results. Next

A272189 Values of A004215(n) such that A004215(n+1) = A004215(n) + 8 = A004215(n-1) + 16.

Original entry on oeis.org

15, 39, 47, 71, 79, 103, 135, 143, 167, 175, 199, 207, 231, 263, 271, 295, 303, 327, 335, 359, 391, 399, 423, 431, 463, 487, 519, 527, 551, 559, 583, 591, 615, 647, 655, 679, 687, 711, 719, 743, 775, 783, 807, 815, 839, 847, 871, 903, 911, 935, 943, 975, 999, 1031, 1039, 1063, 1071, 1095
Offset: 1

Views

Author

Altug Alkan, Apr 22 2016

Keywords

Comments

If there are k consecutive natural numbers and all of them are members of A000378, then the maximum value of k is 7. So if we randomly choose 2*7+1 consecutive natural numbers, at least one of them must be member of A004215. This sequence gives the average of 15 consecutive natural numbers in the case there is exactly one member from A004215 in these 15 consecutive natural numbers. In other words, this sequence gives the most isolated terms of A004215.
Numbers n which are 7 mod 16 such that n+5 and n-7 are sums of three squares, together with numbers n which are 15 mod 16 such that n+1 and n-3 are sums of three squares. - Charles R Greathouse IV, Apr 25 2016

Examples

			15 is a term because 8, 9, 10, 11, 12, 13, 14 and 16, 17, 18, 19, 20, 21, 22 are consecutive members of A000378.
		

Crossrefs

Programs

A002275 Repunits: (10^n - 1)/9. Often denoted by R_n.

Original entry on oeis.org

0, 1, 11, 111, 1111, 11111, 111111, 1111111, 11111111, 111111111, 1111111111, 11111111111, 111111111111, 1111111111111, 11111111111111, 111111111111111, 1111111111111111, 11111111111111111, 111111111111111111, 1111111111111111111, 11111111111111111111
Offset: 0

Views

Author

Keywords

Comments

R_n is a string of n 1's.
Base-4 representation of Jacobsthal bisection sequence A002450. E.g., a(4)= 1111 because A002450(4)= 85 (in base 10) = 64 + 16 + 4 + 1 = 1*(4^3) + 1*(4^2) + 1*(4^1) + 1. - Paul Barry, Mar 12 2004
Except for the first two terms, these numbers cannot be perfect squares, because x^2 != 11 (mod 100). - Zak Seidov, Dec 05 2008
For n >= 0: a(n) = (A000225(n) written in base 2). - Jaroslav Krizek, Jul 27 2009, edited by M. F. Hasler, Jul 03 2020
Let A be the Hessenberg matrix of order n, defined by: A[1,j]=1, A[i,i]:=10, (i>1), A[i,i-1]=-1, and A[i,j]=0 otherwise. Then, for n>=1, a(n)=det(A). - Milan Janjic, Feb 21 2010
Except 0, 1 and 11, all these integers are Brazilian numbers, A125134. - Bernard Schott, Dec 24 2012
Numbers n such that 11...111 = R_n = (10^n - 1)/9 is prime are in A004023. - Bernard Schott, Dec 24 2012
The terms 0 and 1 are the only squares in this sequence, as a(n) == 3 (mod 4) for n>=2. - Nehul Yadav, Sep 26 2013
For n>=2 the multiplicative order of 10 modulo the a(n) is n. - Robert G. Wilson v, Aug 20 2014
The above is a special case of the statement that the order of z modulo (z^n-1)/(z-1) is n, here for z=10. - Joerg Arndt, Aug 21 2014
From Peter Bala, Sep 20 2015: (Start)
Let d be a divisor of a(n). Let m*d be any multiple of d. Split the decimal expansion of m*d into 2 blocks of contiguous digits a and b, so we have m*d = 10^k*a + b for some k, where 0 <= k < number of decimal digits of m*d. Then d divides a^n - (-b)^n (see McGough). For example, 271 divides a(5) and we find 2^5 + 71^5 = 11*73*271*8291 and 27^5 + 1^5 = 2^2*7*31*61*271 are both divisible by 271. Similarly, 4*271 = 1084 and 10^5 + 84^5 = 2^5*31*47*271*331 while 108^5 + 4^5 = 2^12*7*31*61*271 are again both divisible by 271. (End)
Starting with the second term this sequence is the binary representation of the n-th iteration of the Rule 220 and 252 elementary cellular automaton starting with a single ON (black) cell. - Robert Price, Feb 21 2016
If p > 5 is a prime, then p divides a(p-1). - Thomas Ordowski, Apr 10 2016
0, 1 and 11 are only terms that are of the form x^2 + y^2 + z^2 where x, y, z are integers. In other words, a(n) is a member of A004215 for all n > 2. - Altug Alkan, May 08 2016
Except for the initial terms, the binary representation of the x-axis, from the left edge to the origin, of the n-th stage of growth of the two-dimensional cellular automaton defined by "Rule 737", based on the 5-celled von Neumann neighborhood, initialized with a single black (ON) cell at stage zero. - Robert Price, Mar 17 2017
The term "repunit" was coined by Albert H. Beiler in 1964. - Amiram Eldar, Nov 13 2020
q-integers for q = 10. - John Keith, Apr 12 2021
Binomial transform of A001019 with leading zero. - Jules Beauchamp, Jan 04 2022

References

  • Albert H. Beiler, Recreations in the Theory of Numbers: The Queen of Mathematics Entertains, New York: Dover Publications, 1964, chapter XI, p. 83.
  • Paulo Ribenboim, The Little Book of Bigger Primes, Springer-Verlag NY 2004. See pp. 235-237.
  • David Wells, The Penguin Dictionary of Curious and Interesting Numbers, Penguin Books, 1987, pp. 197-198.
  • Samuel Yates, Peculiar Properties of Repunits, J. Recr. Math. 2, 139-146, 1969.
  • Samuel Yates, Prime Divisors of Repunits, J. Recr. Math. 8, 33-38, 1975.

Crossrefs

Programs

  • Haskell
    a002275 = (`div` 9) . subtract 1 . (10 ^)
    a002275_list = iterate ((+ 1) . (* 10)) 0
    -- Reinhard Zumkeller, Jul 05 2013, Feb 05 2012
    
  • Magma
    [(10^n-1)/9: n in [0..25]]; // Vincenzo Librandi, Nov 06 2014
    
  • Maple
    seq((10^k - 1)/9, k=0..30); # Wesley Ivan Hurt, Sep 28 2013
  • Mathematica
    Table[(10^n - 1)/9, {n, 0, 19}] (* Alonso del Arte, Nov 15 2011 *)
    Join[{0},Table[FromDigits[PadRight[{},n,1]],{n,20}]] (* Harvey P. Dale, Mar 04 2012 *)
  • Maxima
    a[0]:0$
    a[1]:1$
    a[n]:=11*a[n-1]-10*a[n-2]$
    A002275(n):=a[n]$
    makelist(A002275(n),n,0,30); /* Martin Ettl, Nov 05 2012 */
    
  • PARI
    a(n)=(10^n-1)/9; \\ Michael B. Porter, Oct 26 2009
    
  • PARI
    my(x='x+O('x^30)); concat(0, Vec(x/((1-10*x)*(1-x)))) \\ Altug Alkan, Apr 10 2016
    
  • Python
    print([(10**n-1)//9 for n in range(100)]) # Michael S. Branicky, Apr 30 2022
  • Sage
    [lucas_number1(n, 11, 10) for n in range(21)]  # Zerinvary Lajos, Apr 27 2009
    

Formula

a(n) = 10*a(n-1) + 1, a(0)=0.
a(n) = A000042(n) for n >= 1.
Second binomial transform of Jacobsthal trisection A001045(3n)/3 (A015565). - Paul Barry, Mar 24 2004
G.f.: x/((1-10*x)*(1-x)). Regarded as base b numbers, g.f. x/((1-b*x)*(1-x)). - Franklin T. Adams-Watters, Jun 15 2006
a(n) = 11*a(n-1) - 10*a(n-2), a(0)=0, a(1)=1. - Lekraj Beedassy, Jun 07 2006
a(n) = A125118(n,9) for n>8. - Reinhard Zumkeller, Nov 21 2006
a(n) = A075412(n)/A002283(n). - Reinhard Zumkeller, May 31 2010
a(n) = a(n-1) + 10^(n-1) with a(0)=0. - Vincenzo Librandi, Jul 22 2010
a(n) = A242614(n,A242622(n)). - Reinhard Zumkeller, Jul 17 2014
E.g.f.: (exp(9*x) - 1)*exp(x)/9. - Ilya Gutkovskiy, May 11 2016
a(n) = Sum_{k=0..n-1} 10^k. - Torlach Rush, Nov 03 2020
Sum_{n>=1} 1/a(n) = A065444. - Amiram Eldar, Nov 13 2020
From Elmo R. Oliveira, Aug 02 2025: (Start)
a(n) = A002283(n)/9 = A105279(n)/10.
a(n) = A010785(A017173(n-1)) for n >= 1. (End)

A002828 Least number of squares that add up to n.

Original entry on oeis.org

0, 1, 2, 3, 1, 2, 3, 4, 2, 1, 2, 3, 3, 2, 3, 4, 1, 2, 2, 3, 2, 3, 3, 4, 3, 1, 2, 3, 4, 2, 3, 4, 2, 3, 2, 3, 1, 2, 3, 4, 2, 2, 3, 3, 3, 2, 3, 4, 3, 1, 2, 3, 2, 2, 3, 4, 3, 3, 2, 3, 4, 2, 3, 4, 1, 2, 3, 3, 2, 3, 3, 4, 2, 2, 2, 3, 3, 3, 3, 4, 2, 1, 2, 3, 3, 2, 3, 4, 3, 2, 2, 3, 4, 3, 3, 4, 3, 2, 2, 3, 1, 2, 3, 4, 2, 3
Offset: 0

Views

Author

Keywords

Comments

Lagrange's "Four Squares theorem" states that a(n) <= 4.
It is easy to show that this is also the least number of squares that add up to n^3.
a(n) is the number of iterations in f(...f(f(n))...) to reach 0, where f(n) = A262678(n) = n - A262689(n)^2. Allows computation of this sequence without Lagrange's theorem. - Antti Karttunen, Sep 09 2016
It is also easy to show that a(k^2*n) = a(n) for k > 0: Clearly a(k^2*n) <= a(n) but for all 4 cases of a(n) there is no k which would result in a(k^2*n) < a(n). - Peter Schorn, Sep 06 2021

References

  • 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

  • Haskell
    a002828 0 = 0  -- confessedly  /= 1, as sum [] == 0
    a002828 n | a010052 n == 1 = 1
              | a025426 n > 0 = 2 | a025427 n > 0 = 3 | otherwise = 4
    -- Reinhard Zumkeller, Feb 26 2015
    
  • Maple
    with(transforms);
    sq:=[seq(n^2, n=1..20)];
    LAGRANGE(sq,4,120);
    # alternative:
    f:= proc(n) local F,x;
       if issqr(n) then return 1 fi;
       if nops(select(t -> t[1] mod 4 = 3 and t[2]::odd, ifactors(n)[2])) = 0 then return 2 fi;
       x:= n/4^floor(padic:-ordp(n,2)/2);
       if x mod 8 = 7 then 4 else 3 fi
    end proc:
    0, seq(f(n),n=1..200); # Robert Israel, Jun 14 2016
    # next Maple program:
    b:= proc(n, i) option remember; convert(series(`if`(n=0, 1, `if`(i<1, 0,
          b(n, i-1)+(s-> `if`(s>n, 0, x*b(n-s, i)))(i^2))), x, 5), polynom)
        end:
    a:= n-> ldegree(b(n, isqrt(n))):
    seq(a(n), n=0..105);  # Alois P. Heinz, Oct 30 2021
  • Mathematica
    SquareCnt[n_] := If[SquaresR[1, n] > 0, 1, If[SquaresR[2, n] > 0, 2, If[SquaresR[3, n] > 0, 3, 4]]]; Table[SquareCnt[n], {n, 150}] (* T. D. Noe, Apr 01 2011 *)
    sc[n_]:=Module[{s=SquaresR[Range[4],n]},If[First[s]>0,1,Length[ First[ Split[ s]]]+1]]; Join[{0},Array[sc,110]] (* Harvey P. Dale, May 21 2014 *)
  • PARI
    istwo(n:int)=my(f);if(n<3,return(n>=0););f=factor(n>>valuation(n, 2)); for(i=1,#f[,1],if(bitand(f[i,2],1)==1&&bitand(f[i,1],3)==3, return(0)));1
    isthree(n:int)=my(tmp=valuation(n,2));bitand(tmp,1)||bitand(n>>tmp,7)!=7
    a(n)=if(isthree(n), if(issquare(n), !!n, 3-istwo(n)), 4) \\ Charles R Greathouse IV, Jul 19 2011, revised Mar 17 2022
    
  • Python
    from sympy import factorint
    def A002828(n):
        if n == 0: return 0
        f = factorint(n).items()
        if not any(e&1 for p,e in f): return 1
        if all(p&3<3 or e&1^1 for p,e in f): return 2
        return 3+(((m:=(~n&n-1).bit_length())&1^1)&int((n>>m)&7==7)) # Chai Wah Wu, Aug 01 2023
    
  • Python
    from sympy.core.power import isqrt
    def A002828(n):
        dp = [-1] * (n + 1)
        dp[0] = 0
        for i in range(1, n + 1):
            S = []
            r = isqrt(i)
            for j in range(1, r + 1):
                S.append(1 + dp[i - (j**2)])
            dp[i] = min(S)
        return dp[-1] # Darío Clavijo, Apr 21 2025
  • Scheme
    ;; The first one follows Charles R Greathouse IV's PARI-code above:
    (define (A002828 n) (cond ((zero? n) n) ((= 1 (A010052 n)) 1) ((= 1 (A229062 n)) 2) (else (+ 3 (A072401 n)))))
    (define (A229062 n) (- 1 (A000035 (A260728 n))))
    ;; We can also compute this without relying on Lagrange's theorem. The following recursion-formula should be used together with the second Scheme-implementation of A262689 given in the Program section that entry:
    (definec (A002828 n) (if (zero? n) n (+ 1 (A002828 (- n (A000290 (A262689 n)))))))
    ;; Antti Karttunen, Sep 09 2016
    

Formula

From Antti Karttunen, Sep 09 2016: (Start)
a(0) = 0; and for n >= 1, if A010052(n) = 1 [when n is a square], a(n) = 1, otherwise, if A229062(n)=1, then a(n) = 2, otherwise a(n) = 3 + A072401(n). [After Charles R Greathouse IV's PARI program.]
a(0) = 0; for n >= 1, a(n) = 1 + a(n - A262689(n)^2), (see comments).
a(n) = A053610(n) - A062535(n).
(End)

Extensions

More terms from Arlin Anderson (starship1(AT)gmail.com)

A005875 Theta series of simple cubic lattice; also number of ways of writing a nonnegative integer n as a sum of 3 squares (zero being allowed).

Original entry on oeis.org

1, 6, 12, 8, 6, 24, 24, 0, 12, 30, 24, 24, 8, 24, 48, 0, 6, 48, 36, 24, 24, 48, 24, 0, 24, 30, 72, 32, 0, 72, 48, 0, 12, 48, 48, 48, 30, 24, 72, 0, 24, 96, 48, 24, 24, 72, 48, 0, 8, 54, 84, 48, 24, 72, 96, 0, 48, 48, 24, 72, 0, 72, 96, 0, 6, 96, 96, 24, 48, 96, 48, 0, 36, 48, 120
Offset: 0

Views

Author

Keywords

Comments

Number of ordered triples (i, j, k) of integers such that n = i^2 + j^2 + k^2.
The Madelung Coulomb energy for alternating unit charges in the simple cubic lattice is Sum_{n>=1} (-1)^n*a(n)/sqrt(n) = -A085469. - R. J. Mathar, Apr 29 2006
a(A004215(k))=0 for k=1,2,3,... but no other elements of {a(n)} are zero. - Graeme McRae, Jan 15 2007

Examples

			Order and signs are taken into account: a(1) = 6 from 1 = (+-1)^2 + 0^2 + 0^2, a(2) = 12 from 2 = (+-1)^2 + (+-1)^2 + 0^2; a(3) = 8 from 3 = (+-1)^2 + (+-1)^2 + (+-1)^2, etc.
G.f. =  1 + 6*q + 12*q^2 + 8*q^3 + 6*q^4 + 24*q^5 + 24*q^6 + 12*q^8 + 30*q^9 + 24*q^10 + ...
		

References

  • H. Cohen, Number Theory, Vol. 1: Tools and Diophantine Equations, Springer-Verlag, 2007, p. 317.
  • J. H. Conway and N. J. A. Sloane, "Sphere Packings, Lattices and Groups", Springer-Verlag, p. 107.
  • H. Davenport, The Higher Arithmetic. Cambridge Univ. Press, 7th ed., 1999, Chapter V.
  • L. E. Dickson, History of the Theory of Numbers. Carnegie Institute Public. 256, Washington, DC, Vol. 1, 1919; Vol. 2, 1920; Vol. 3, 1923, see vol. 3, p. 109.
  • E. Grosswald, Representations of Integers as Sums of Squares. Springer-Verlag, NY, 1985, p. 54.
  • L. Kronecker, Crelle, Vol. LVII (1860), p. 248; Werke, Vol. IV, p. 188.
  • C. J. Moreno and S. S. Wagstaff, Jr., Sums of Squares of Integers, Chapman and Hall, 2006, p. 43.
  • T. Nagell, Introduction to Number Theory, Wiley, 1951, p. 194.
  • W. Sierpiński, 1925. Teorja Liczb. pp. 1-410 (p.61).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • H. J. S. Smith, Report on the Theory of Numbers, reprinted in Vol. 1 of his Collected Math. Papers, Chelsea, NY, 1979, see p. 338, Eq. (B').

Crossrefs

Row d=3 of A122141 and of A319574, 3rd column of A286815.
Cf. A074590 (primitive solutions), A117609 (partial sums), A004215 (positions of zeros).
Analog for 4 squares: A000118.
x^2+y^2+k*z^2: A005875, A014455, A034933, A169783, A169784.
Ramanujan theta functions: f(q) (see A121373), phi(q) (A000122), psi(q) (A010054), chi(q) (A000700).

Programs

  • Julia
    # JacobiTheta3 is defined in A000122.
    A005875List(len) = JacobiTheta3(len, 3)
    A005875List(75) |> println # Peter Luschny, Mar 12 2018
    
  • Magma
    Basis( ModularForms( Gamma1(4), 3/2), 75) [1]; /* Michael Somos, Jun 25 2014 */
    
  • Maple
    (sum(x^(m^2),m=-10..10))^3; seq(coeff(%,x,n), n=0..50);
    Alternative:
    A005875list := proc(len) series(JacobiTheta3(0, x)^3, x, len+1);
    seq(coeff(%, x, j), j=0..len-1) end: A005875list(75); # Peter Luschny, Oct 02 2018
  • Mathematica
    SquaresR[3,Range[0,80]] (* Harvey P. Dale, Jul 21 2011 *)
    a[ n_] := SeriesCoefficient[ EllipticTheta[ 3, 0, q]^3, {q, 0, n}]; (* Michael Somos, Jun 25 2014 *)
    a[ n_] := Length @ FindInstance[ n == x^2 + y^2 + z^2, {x, y, z}, Integers, 10^9]; (* Michael Somos, May 21 2015 *)
    QP = QPochhammer; CoefficientList[(QP[q^2]^5/(QP[q]*QP[q^4])^2)^3 + O[q]^80, q] (* Jean-François Alcover, Nov 24 2015 *)
  • PARI
    {a(n) = if( n<0, 0, polcoeff( sum( k=1, sqrtint(n), 2 * x^k^2, 1 + x * O(x^n))^3, n))};
    
  • PARI
    {a(n) = my(A); if( n<0, 0, A = x * O(x^n); polcoeff( (eta(x^2 + A)^5 / (eta(x + A) * eta(x^4 + A))^2)^3, n))}; /* Michael Somos, Jun 03 2012 */
    
  • PARI
    {a(n) = my(G); if( n<0, 0, G = [ 1, 0, 0; 0, 1, 0; 0, 0, 1]; polcoeff( 1 + 2 * x * Ser( qfrep( G, n)), n))}; /* Michael Somos, May 21 2015 */
    
  • Python
    # uses Python code for A004018
    from math import isqrt
    def A005875(n): return A004018(n)+(sum(A004018(n-k**2) for k in range(1,isqrt(n)+1))<<1) # Chai Wah Wu, Jun 21 2024
  • Sage
    Q = DiagonalQuadraticForm(ZZ, [1]*3)
    Q.representation_number_list(75) # Peter Luschny, Jun 20 2014
    

Formula

A number n is representable as the sum of 3 squares iff n is not of the form 4^a (8k+7) (cf. A000378).
There is a classical formula (essentially due to Gauss):
For sums of 3 squares r_3(n): write (uniquely) -n=D(2^vf)^2, with D<0 fundamental discriminant, f odd, v>=-1. Then r_3(n) = 12L((D/.),0)(1-(D/2)) Sum_{d | f} mu(d)(D/d)sigma(f/d).
Here mu is the Moebius function, (D/2) and (D/d) are Kronecker-Legendre symbols, sigma is the sum of divisors function, L((D/.),0)=h(D)/(w(D)/2) is the value at 0 of the L function of the quadratic character (D/.), equal to the class number h(D) divided by 2 or 3 in the special cases D=-4 and -3. - Henri Cohen (Henri.Cohen(AT)math.u-bordeaux1.fr), May 12 2010
a(n) = 3*T(n) if n == 1,2,5,6 mod 8, = 2*T(n) if n == 3 mod 8, = 0 if n == 7 mod 8 and = a(n/4) if n == 0 mod 4, where T(n) = A117726(n). [Moreno-Wagstaff].
"If 12E(n) is the number of representations of n as a sum of three squares, then E(n) = 2F(n) - G(n) where G(n) = number of classes of determinant -n, F(n) = number of uneven classes." - Dickson, quoting Kronecker. [Cf. A117726.]
a(n) = Sum_{d^2|n} b(n/d^2), where b() = A074590() gives the number of primitive solutions.
Expansion of phi(q)^3 in powers of q where phi() is a Ramanujan theta function. - Michael Somos, Oct 25 2006.
Euler transform of period 4 sequence [ 6, -9, 6, -3, ...]. - Michael Somos, Oct 25 2006
G.f.: (Sum_{k in Z} x^(k^2))^3.
a(8*n + 7) = 0. a(4*n) = a(n).
a(n) = A004015(2*n) = A014455(2*n) = A004013(4*n) = A169783(4*n). a(4*n + 1) = 6 * A045834(n). a(8*n + 3) = 8 * A008443(n). a(8*n + 5) = 24 * A045831(n). - Michael Somos, Jun 03 2012
a(4*n + 2) = 12 * A045828(n). - Michael Somos, Sep 03 2014
a(n) = (-1)^n * A213384(n). - Michael Somos, May 21 2015
a(n) = (6/n)*Sum_{k=1..n} A186690(k)*a(n-k), a(0) = 1. - Seiichi Manyama, May 27 2017
a(n) = A004018(n) + 2*Sum_{k=1..floor(sqrt(n))} A004018(n - k^2). - Daniel Suteu, Aug 27 2021
Convolution cube of A000122. Convolution of A004018 and A000122. - R. J. Mathar, Aug 03 2025

Extensions

More terms from James Sellers, Aug 22 2000

A007522 Primes of the form 8n+7, that is, primes congruent to -1 mod 8.

Original entry on oeis.org

7, 23, 31, 47, 71, 79, 103, 127, 151, 167, 191, 199, 223, 239, 263, 271, 311, 359, 367, 383, 431, 439, 463, 479, 487, 503, 599, 607, 631, 647, 719, 727, 743, 751, 823, 839, 863, 887, 911, 919, 967, 983, 991, 1031, 1039, 1063, 1087, 1103, 1151
Offset: 1

Views

Author

Keywords

Comments

Primes that are the sum of no fewer than four positive squares.
Discriminant is 32, class is 2. Binary quadratic forms ax^2 + bxy + cy^2 have discriminant d = b^2 - 4ac and gcd(a, b, c) = 1.
Primes p such that x^4 = 2 has just two solutions mod p. Subsequence of A040098. Solutions mod p are represented by integers from 0 to p - 1. For p > 2, i is a solution mod p of x^4 = 2 if and only if p - i is a solution mod p of x^4 = 2, so the sum of the two solutions is p. The solutions are given in A065907 and A065908. - Klaus Brockhaus, Nov 28 2001
As this is a subset of A001132, this is also a subset of the primes of form x^2 - 2y^2. And as this is also a subset of A038873, this is also a subset of the primes of form x^2 - 2y^2. - Tito Piezas III, Dec 28 2008
Subsequence of A141164. - Reinhard Zumkeller, Mar 26 2011
Also a subsequence of primes of the form x^2 + y^2 + z^2 + 1. - Arkadiusz Wesolowski, Apr 05 2012
Primes p such that p XOR 6 = p - 6. - Brad Clardy, Jul 22 2012

References

  • Z. I. Borevich and I. R. Shafarevich, Number Theory. Academic Press, NY, 1966.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • D. B. Zagier, Zetafunktionen und quadratische Körper, Springer, 1981.

Crossrefs

Subsequence of A004771.
Cf. A141174 (d = 32). A038872 (d = 5). A038873 (d = 8). A068228, A141123 (d = 12). A038883 (d = 13). A038889 (d = 17). A141111, A141112 (d = 65).

Programs

  • Haskell
    a007522 n = a007522_list !! (n-1)
    a007522_list = filter ((== 1) . a010051) a004771_list
    -- Reinhard Zumkeller, Jan 29 2013
    
  • Magma
    [p: p in PrimesUpTo(2000) | p mod 8 eq 7]; // Vincenzo Librandi, Jun 26 2014
  • Maple
    select(isprime, [seq(i,i=7..10000,8)]); # Robert Israel, Nov 22 2016
  • Mathematica
    Select[8Range[200] - 1, PrimeQ] (* Alonso del Arte, Nov 07 2016 *)
  • PARI
    (A007522(m) = local(p, s, x, z); forprime(p = 3, m, s = []; for(x = 0, p-1, if(x^4%p == 2%p, s = concat(s, [x]))); z = matsize(s)[2]; if(z == 2, print1(p, ", ")))); A007522(1400)  \\ Does not return a(m) but prints all terms <= m. - Edited to make it executable by M. F. Hasler, May 22 2025.
    
  • PARI
    A007522_upto(N, start=1)=select(p->p%8==7, primes([start, N]))
    #A7522=A007522_upto(10^5)
    A007522(n)={while(#A7522A007522_upto(N*3\2, N+1))); A7522[n]} \\ M. F. Hasler, May 22 2025
    

Formula

Equals A000040 INTERSECT A004215. - R. J. Mathar, Nov 22 2006
a(n) = 7 + A139487(n)*8, n >= 1. - Wolfdieter Lang, Feb 18 2015

A000378 Sums of three squares: numbers of the form x^2 + y^2 + z^2.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 16, 17, 18, 19, 20, 21, 22, 24, 25, 26, 27, 29, 30, 32, 33, 34, 35, 36, 37, 38, 40, 41, 42, 43, 44, 45, 46, 48, 49, 50, 51, 52, 53, 54, 56, 57, 58, 59, 61, 62, 64, 65, 66, 67, 68, 69, 70, 72, 73, 74, 75, 76, 77, 78, 80, 81, 82, 83
Offset: 1

Views

Author

Keywords

Comments

An equivalent definition: numbers of the form x^2 + y^2 + z^2 with x,y,z >= 0.
Bourgain studies "the spatial distribution of the representation of a large integer as a sum of three squares, on the small and critical scale as well as their electrostatic energy. The main results announced give strong evidence to the thesis that the solutions behave randomly. This is in sharp contrast to what happens with sums of two or four or more square." Sums of two nonzero squares are A000404. - Jonathan Vos Post, Apr 03 2012
The multiplicities for a(n) (if 0 <= x <= y <= z) are given as A000164(a(n)), n >= 1. Compare with A005875(a(n)) for integer x, y and z, and order taken into account. - Wolfdieter Lang, Apr 08 2013
a(n)^k is a member of this sequence for any k > 1. - Boris Putievskiy, May 05 2013
The selection rule for the planes with Miller indices (hkl) to undergo X-ray diffraction in a simple cubic lattice is h^2+k^2+l^2 = N where N is a term of this sequence. See A004014 for f.c.c. lattice. - Mohammed Yaseen, Nov 06 2022

Examples

			a(1) = 0 = 0^2 + 0^2 + 0^2. A005875(0) = 1 = A000164(0).
a(9) = 9 = 0^2 + 0^2 + 3^2 =  1^2 +  2^2 + 2^2. A000164(9) = 2. A000164(9) = 30 = 2*3 + 8*3 (counting signs and order). - _Wolfdieter Lang_, Apr 08 2013
		

References

  • J. H. Conway and N. J. A. Sloane, "Sphere Packings, Lattices and Groups", Springer-Verlag, p. 107.
  • E. Grosswald, Representations of Integers as Sums of Squares. Springer-Verlag, NY, 1985, p. 37.
  • R. K. Guy, Unsolved Problems in Number Theory, Springer, 1st edition, 1981. See section C20.
  • G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers. 3rd ed., Oxford Univ. Press, 1954, p. 311.

Crossrefs

Union of A000290, A000404 and A000408 (common elements).
Union of A000290, A000415 and A000419 (disjunct sets).
Complement of A004215.
Cf. A005875 (number of representations if x, y and z are integers).

Programs

  • Maple
    isA000378 := proc(n) # return true or false depending on n being in the list
        local x,y ;
        for x from 0 do
            if 3*x^2 > n then
                return false;
            end if;
            for y from x do
                if x^2+2*y^2 > n then
                    break;
                else
                    if issqr(n-x^2-y^2) then
                        return true;
                    end if;
                end if;
            end do:
        end do:
    end proc:
    A000378 := proc(n) # generate A000378(n)
        option remember;
        local a;
        if n = 1 then
            0;
        else
            for a from procname(n-1)+1 do
                if isA000378(a) then
                    return a;
                end if;
            end do:
        end if;
    end proc:
    seq(A000378(n),n=1..100) ; # R. J. Mathar, Sep 09 2015
  • Mathematica
    okQ[n_] := If[EvenQ[k = IntegerExponent[n, 2]], m = n/2^k; Mod[m, 8] != 7, True]; Select[Range[0, 100], okQ] (* Jean-François Alcover, Feb 08 2016, adapted from PARI *)
  • PARI
    isA000378(n)=my(k=valuation(n, 2)); if(k%2==0, n>>=k; n%8!=7, 1)
    
  • PARI
    list(lim)=my(v=List(),k,t); for(x=0,sqrtint(lim\=1), for(y=0, min(sqrtint(lim-x^2),x), k=x^2+y^2; for(z=0,min(sqrtint(lim-k), y), listput(v,k+z^2)))); Set(v) \\ Charles R Greathouse IV, Sep 14 2015
    
  • Python
    def valuation(n, b):
        v = 0
        while n > 1 and n%b == 0: n //= b; v += 1
        return v
    def ok(n): return n//4**valuation(n, 4)%8 != 7
    print(list(filter(ok, range(84)))) # Michael S. Branicky, Jul 15 2021
    
  • Python
    from itertools import count, islice
    def A000378_gen(): # generator of terms
        return filter(lambda n:n>>2*(bin(n)[:1:-1].index('1')//2) & 7 < 7, count(1))
    A000378_list = list(islice(A000378_gen(),30)) # Chai Wah Wu, Jun 27 2022
    
  • Python
    def A000378(n):
        def f(x): return n-1+sum(((x>>(i<<1))-7>>3)+1 for i in range(x.bit_length()>>1))
        m, k = n-1, f(n-1)
        while m != k: m, k = k, f(k)
        return m # Chai Wah Wu, Feb 14 2025

Formula

Legendre: a nonnegative integer is a sum of three squares iff it is not of the form 4^k m with m == 7 (mod 8).
n^(2k+1) is in the sequence iff n is in the sequence. - Ray Chandler, Feb 03 2009
Complement of A004215; complement of A000302(i)*A004771(j), i,j>=0. - Boris Putievskiy, May 05 2013
a(n) = 6n/5 + O(log n). - Charles R Greathouse IV, Mar 14 2014

Extensions

More terms from Ray Chandler, Sep 05 2004

A000164 Number of partitions of n into 3 squares (allowing part zero).

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 0, 1, 2, 1, 1, 1, 1, 1, 0, 1, 2, 2, 1, 1, 1, 1, 0, 1, 2, 2, 2, 0, 2, 1, 0, 1, 2, 2, 1, 2, 1, 2, 0, 1, 3, 1, 1, 1, 2, 1, 0, 1, 2, 3, 2, 1, 2, 3, 0, 1, 2, 1, 2, 0, 2, 2, 0, 1, 3, 3, 1, 2, 2, 1, 0, 2, 2, 3, 2, 1, 2, 1, 0, 1, 4, 2, 2, 1, 2, 3, 0, 1, 4, 3, 1, 0, 1, 2, 0, 1, 2, 3, 3, 2, 4, 2, 0, 2
Offset: 0

Views

Author

Keywords

Comments

a(n) = number of triples of integers [ i, j, k] such that i >= j >= k >= 0 and n = i^2 + j^2 + k^2. - Michael Somos, Jun 05 2012

Examples

			G.f. = 1 + x + x^2 + x^3 + x^4 + x^5 + x^6 + x^8 + 2*x^9 + x^10 + x^11 + x^12 + x^13 + ...
		

References

  • E. Grosswald, Representations of Integers as Sums of Squares. Springer-Verlag, NY, 1985, p. 84.

Crossrefs

Equivalent sequences for other numbers of squares: A000161 (2), A002635 (4), A000174 (5).
Cf. A004215 (positions of zeros), A094942 (positions of ones), A124966 (positions of greater values).

Programs

  • Maple
    A000164 := proc(n)
        local a,x,y,z2,z ;
        a := 0 ;
        for x from 0 do
            if 3*x^2 > n then
                return a;
            end if;
            for y from x do
                if x^2+2*y^2 > n then
                    break;
                end if;
                z2 := n-x^2-y^2 ;
                if issqr(z2) then
                    z := sqrt(z2) ;
                    if z >= y then
                        a := a+1 ;
                    end if;
                end if;
            end do:
        end do:
        a;
    end proc: # R. J. Mathar, Feb 12 2017
  • Mathematica
    Length[PowersRepresentations[ #, 3, 2]] & /@ Range[0, 104]
    e[0,r_,s_,m_]=0;e[n_,r_,s_,m_]:=Length[Select[Divisors[n],Mod[ #,m]==r &]]-Length[Select[Divisors[n],Mod[ #,m]==s &]];alpha[n_]:=5delta[n]+3delta[1/2 n]+4delta[1/3n];beta[n_]:=4e[n,1,3,4]+3e[n,1,7,8]+3e[n,3,5,8];delta[n_]:=If[IntegerQ[Sqrt[n]],1,0];f[n_]:=Table[n-k^2, {k,1,Floor[Sqrt[n]]}]; gamma[n_]:=2 Plus@@(e[ #,1,3,4] &/@f[n]);p3[n_]:=1/12(alpha[n]+beta[n]+gamma[n]);p3[ # ] &/@Range[0,104]
    (* Ant King, Oct 15 2010 *)
    a[ n_] := If[ n < 0, 0, Sum[ Boole[ n == i^2 + j^2 + k^2], {i, 0, Sqrt[n]}, {j, 0, i}, {k, 0, j}]]; (* Michael Somos, Aug 15 2015 *)
  • PARI
    {a(n) = if( n<0, 0, sum( i=0, sqrtint(n), sum( j=0, i, sum( k=0, j, n == i^2 + j^2 + k^2))))}; /* Michael Somos, Jun 05 2012 */
    
  • Python
    import collections; a = collections.Counter(i*i + j*j + k*k for i in range(100) for j in range(i+1) for k in range(j+1)) # David Radcliffe, Apr 15 2019

Formula

Let e(n,r,s,m) be the excess of the number of n's r(mod m) divisors over the number of its s (mod m) divisors, and let delta(n)=1 if n is a perfect square and 0 otherwise. Then, if we define alpha(n) = 5*delta(n) + 3*delta(n/2) + 4*delta(n/3), beta(n) = 4*e(n,1,3,4) + 3*e(n,1,7,8) + 3*e(n,3,5,8), gamma(n) = 2*Sum_{1<=k^2Ant King, Oct 15 2010

Extensions

Name clarified by Wolfdieter Lang, Apr 08 2013

A023105 Number of distinct quadratic residues mod 2^n.

Original entry on oeis.org

1, 2, 2, 3, 4, 7, 12, 23, 44, 87, 172, 343, 684, 1367, 2732, 5463, 10924, 21847, 43692, 87383, 174764, 349527, 699052, 1398103, 2796204, 5592407, 11184812, 22369623, 44739244, 89478487, 178956972, 357913943, 715827884, 1431655767, 2863311532
Offset: 0

Views

Author

Keywords

Comments

Number of distinct n-digit suffixes of base 2 squares.
a(n) counts the elements of A234000 smaller than 2^n plus the zero: a(7)=23 counts the elements of {0, 1, 4, 9, ..., 113, 121}, for example. - R. J. Mathar, Oct 11 2014
Conjecture: a(n) = 2 + (the number of A004215 entries < 2^n), for n>0. - Tilman Neumann, Sep 20 2020

Crossrefs

Programs

  • Haskell
    a 0 = 1
    a 1 = 2
    a n | even n = 2*a(n-1)-2
    a n | odd  n = 2*a(n-1)-1
    -- James Spahlinger, Oct 07 2012
    
  • Magma
    [Floor((2^n+10)/6): n in [0..30]]; // Vincenzo Librandi, Apr 21 2012
    
  • Mathematica
    CoefficientList[Series[(1-3*x^2-x^3)/((1-x)*(1+x)*(1-2*x)),{x,0,35}],x] (* Vincenzo Librandi, Apr 21 2012 *)
    LinearRecurrence[{2,1,-2},{1,2,2,3},40] (* Harvey P. Dale, Mar 05 2016 *)
  • PARI
    a(n)=(2^n+10)\6 \\ Charles R Greathouse IV, Apr 21 2012
    
  • Python
    def A023105(n): return ((1<Chai Wah Wu, Aug 22 2023
  • SageMath
    [(2^n +9 -(-1)^n -3*bool(n==0))/6 for n in (0..30)] # G. C. Greubel, Aug 10 2022
    

Formula

a(n) = floor( (2^n+10)/6 ).
a(n) = (2^n + 9 - (-1)^n)/6 for n > 0. - David S. Dodson, Jan 06 2013
G.f.: (1-3*x^2-x^3)/((1-x)*(1+x)*(1-2*x)). - Colin Barker, Mar 08 2012
a(0)=1, a(1)=2. a(n) = 2*a(n-1)-2 if n is even, a(n) = 2*a(n-1)-1 if n is odd. - Vincenzo Librandi, Apr 21 2012
a(n) = 2*a(n-1) + a(n-2) - 2*a(n-3) for n > 0. - Joerg Arndt, Apr 21 2012
a(0)=1, a(1)=2, a(n+2) = a(n+1) + A001045(n) for n >= 1. - Lee Hae-hwang, Jun 16 2014
a(n) = A000224(2^n). - R. J. Mathar, Oct 10 2014
a(n) = A005578(n-1) + 1, n > 0. - Carl Joshua Quines, Jul 17 2019
E.g.f.: (exp(2*x) + 9*exp(x) - 3 - exp(-x))/6. - G. C. Greubel, Aug 10 2022

A191257 a(n) = A067368(n)/2.

Original entry on oeis.org

1, 3, 5, 7, 8, 9, 11, 13, 15, 17, 19, 21, 23, 24, 25, 27, 29, 31, 33, 35, 37, 39, 40, 41, 43, 45, 47, 49, 51, 53, 55, 56, 57, 59, 61, 63, 64, 65, 67, 69, 71, 72, 73, 75, 77, 79, 81, 83, 85, 87, 88, 89, 91, 93, 95, 97, 99, 101, 103, 104, 105, 107, 109, 111, 113, 115, 117, 119, 120, 121, 123, 125, 127, 129, 131, 133, 135, 136, 137, 139, 141, 143
Offset: 1

Views

Author

Clark Kimberling, May 28 2011

Keywords

Comments

From Jianing Song, Sep 21 2018: (Start)
Numbers n such that A191255(n) = 0 or 3. Previous definition was numbers n such that A191255(2*n) = 1, that is, numbers of the form 2^(3t)*s where s is an odd number.
{+-a(n)} gives all nonzero cubes modulo all powers of 2, that is, nonzero cubes over the 2-adic integers. So this sequence is closed under multiplication. (End)
The old entry had the conjecture that a(n) = A067368(n)/2. Jianing Song, Sep 21 2018 showed that this is true, and gave us the simpler definition that we have now used. The conjecture is correct because {a(n)} lists the numbers of the form 2^(3t)*s, and {A067368(n)} lists the numbers of the form 2^(3t+1)*s, where s is an odd number. Note also that a(n) = A213258(n)/4.
The asymptotic density of this sequence is 4/7. - Amiram Eldar, May 31 2024

Crossrefs

Perfect powers over the 2-adic integers:
Squares: positive: A234000; negative: A004215 (negated);
Cubes: this sequence;
Fourth powers: positive: A319281; negative: A319282 (negated).

Programs

  • Mathematica
    t = Nest[Flatten[# /. {0 -> {0, 1}, 1 -> {0, 2}, 2 -> {0, 3},
          3 -> {0, 1}}] &, {0}, 9] (* A191255 *)
    Flatten[Position[t, 0]] (* A005408, the odds *)
    a = Flatten[Position[t, 1]] (* A067368 *)
    b = Flatten[Position[t, 2]] (* A213258 *)
    a/2  (* A191257 *)
    b/4  (* a/2 *)
  • PARI
    isok(n) = valuation(2*n, 2)%3==1; \\ Altug Alkan, Sep 21 2018
    
  • Python
    def A191257(n):
        def f(x): return n+x-sum(((x>>i)-1>>1)+1 for i in range(0,x.bit_length(),3))
        m, k = n, f(n)
        while m != k: m, k = k, f(k)
        return m # Chai Wah Wu, Feb 17 2025

Extensions

Name corrected by Altug Alkan, Apr 03 2018
New name from Jianing Song, Sep 21 2018

A234000 Numbers of the form 4^i*(8*j+1).

Original entry on oeis.org

1, 4, 9, 16, 17, 25, 33, 36, 41, 49, 57, 64, 65, 68, 73, 81, 89, 97, 100, 105, 113, 121, 129, 132, 137, 144, 145, 153, 161, 164, 169, 177, 185, 193, 196, 201, 209, 217, 225, 228, 233, 241, 249, 256, 257, 260, 265, 272, 273, 281, 289, 292, 297, 305, 313, 321, 324, 329, 337, 345
Offset: 1

Views

Author

V. Raman, Dec 18 2013

Keywords

Comments

Squares modulo all powers of 2. - Robert Israel, Aug 26 2014
From Peter Munn, Dec 11 2019: (Start)
Closed under multiplication.
Contains all even powers of primes.
A subgroup of the positive integers under the binary operation A059897(.,.). For all n, a(n) has no Fermi-Dirac factor of 2 and if m_k denotes the number of Fermi-Dirac factors of a(n) that are congruent to k modulo 8, m_3, m_5 and m_7 have the same parity. It can further be shown (1) all numbers that meet these requirements are in the sequence and (2) this implies closure under A059897(.,.).
(End)

Crossrefs

Cf. A055046 (Numbers of the form 4^i*(8*j+3)).
Cf. A055045 (Numbers of the form 4^i*(8*j+5)).
Cf. A004215 (Numbers of the form 4^i*(8*j+7)).

Programs

  • Maple
    N:= 1000: # to get all terms <= N
    {seq(seq(4^i*(8*k+1), k = 0 .. floor((N * 4^(-i)-1)/8)),i=0..floor(log[4](N)))}; # Robert Israel, Aug 26 2014
  • PARI
    is_A234000(n)=(n/4^valuation(n, 4))%8==1 \\ Charles R Greathouse IV and V. Raman, Dec 19 2013; minor improvement by M. F. Hasler, Jan 02 2014
    
  • PARI
    list(lim)=my(v=List(),t); for(e=0,logint(lim\1,4), t=4^e; forstep(k=t, lim, 8*t, listput(v,k))); Set(v) \\ Charles R Greathouse IV, Jan 12 2017
    
  • Python
    from itertools import count, islice
    def A234000_gen(startvalue=1): # generator of terms >= startvalue
        return filter(lambda n:not (m:=(~n&n-1).bit_length())&1 and (n>>m)&7==1,count(max(startvalue,1)))
    A234000_list = list(islice(A234000_gen(),30)) # Chai Wah Wu, Jul 09 2022
    
  • Python
    def A234000(n):
        def bisection(f,kmin=0,kmax=1):
            while f(kmax) > kmax: kmax <<= 1
            kmin = kmax >> 1
            while kmax-kmin > 1:
                kmid = kmax+kmin>>1
                if f(kmid) <= kmid:
                    kmax = kmid
                else:
                    kmin = kmid
            return kmax
        def f(x): return n+x-sum(((x>>(i<<1))-1>>3)+1 for i in range((x.bit_length()>>1)+1))
        return bisection(f,n,n) # Chai Wah Wu, Feb 14 2025

Formula

a(n) = 6n + O(log n). - Charles R Greathouse IV, Dec 19 2013
a(n) = A055044(n)/2. - Chai Wah Wu, Mar 19 2025
Showing 1-10 of 98 results. Next