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.

Previous Showing 11-17 of 17 results.

A060037 Triangular array T read by rows: T(n,k)=k^2 mod n, for k=1,2,...,[n/2], n=2,3,...

Original entry on oeis.org

1, 1, 1, 0, 1, 4, 1, 4, 3, 1, 4, 2, 1, 4, 1, 0, 1, 4, 0, 7, 1, 4, 9, 6, 5, 1, 4, 9, 5, 3, 1, 4, 9, 4, 1, 0, 1, 4, 9, 3, 12, 10, 1, 4, 9, 2, 11, 8, 7, 1, 4, 9, 1, 10, 6, 4, 1, 4, 9, 0, 9, 4, 1, 0, 1, 4, 9, 16, 8, 2, 15, 13, 1, 4, 9, 16, 7, 0, 13, 10, 9, 1, 4, 9, 16, 6, 17, 11, 7, 5, 1, 4, 9, 16, 5, 16
Offset: 2

Views

Author

N. J. A. Sloane, Mar 17 2001

Keywords

Examples

			1; 1; 1,0; 1,4; 1,4,3; 1,4,2; ...
		

Crossrefs

Programs

  • Mathematica
    Flatten[Table[PowerMod[k,2,n],{n,2,20},{k,Floor[n/2]}]] (* Harvey P. Dale, Mar 05 2012 *)

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Mar 20 2001

A231589 a(n) = sum_{k=1..(n-1)/2} (k^2 mod n).

Original entry on oeis.org

0, 0, 1, 1, 5, 5, 7, 6, 12, 20, 22, 19, 39, 35, 35, 28, 68, 60, 76, 65, 91, 99, 92, 74, 125, 156, 144, 147, 203, 175, 186, 152, 242, 272, 245, 201, 333, 323, 286, 270, 410, 392, 430, 363, 420, 437, 423, 340, 490, 550, 578, 585, 689, 639, 605, 546, 760, 812
Offset: 1

Views

Author

Michel Marcus, Nov 11 2013

Keywords

Comments

This expression occurred to S. A. Shirali while demonstrating a result concerning A081115 and A228432. This led him to investigate integers n such that a(n) = n*(n-1)/4, a(n) = floor(n/4), or a(n) = n*(n-1)/4 - n.

Crossrefs

Programs

  • Mathematica
    Table[Sum[PowerMod[k,2,n],{k,(n-1)/2}],{n,60}] (* Harvey P. Dale, Jan 30 2016 *)
  • PARI
    a(n) = sum(k=1, (n-1)\2, k^2 % n);

A306271 a(n) is the smallest positive integer x such that x^2 mod n is a square, with x^2 >= n.

Original entry on oeis.org

1, 2, 2, 2, 3, 4, 5, 3, 3, 7, 8, 4, 10, 11, 4, 4, 13, 6, 15, 6, 5, 18, 19, 5, 5, 21, 6, 9, 24, 8, 26, 6, 7, 29, 6, 6, 31, 32, 8, 7, 35, 10, 37, 16, 7, 40, 41, 7, 7, 10, 10, 19, 46, 12, 8, 9, 14, 51, 52, 8, 54, 55, 8, 8, 9, 14, 59, 26, 16, 12, 63, 9, 65, 66, 10
Offset: 1

Views

Author

Daniel Suteu, Feb 01 2019

Keywords

Examples

			For n = 10, a(10) = 7, which is the smallest positive integer x such that x^2 mod n is a square and that x^2 >= n. Here 7^2 mod 10 = 9 = 3^2.
		

Crossrefs

Programs

  • Maple
    a:= proc(n) local k, t;
          for k do t:= irem(k^2, n);
            if issqr(t) and isqrt(t)<>k then break fi
          od; k
        end:
    seq(a(n), n=1..100);  # Alois P. Heinz, Feb 01 2019
  • Mathematica
    a[n_] := For[x = Sqrt[n]//Ceiling, True, x++, If[IntegerQ[Sqrt[PowerMod[x, 2, n]]], Return[x]]];
    Array[a, 100] (* Jean-François Alcover, Nov 07 2020 *)
  • PARI
    a(n) = for(k=sqrtint(n), oo, if(issquare(k^2 % n) && sqrtint(k^2 % n) != k, return(k)));

Formula

a(n^2) = n.
a(p) = p - floor(sqrt(p)), for prime p > 2.

A343720 Triangle read by rows: T(n,k) = k^2 mod n for k = 0..n-1, n >= 1.

Original entry on oeis.org

0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 4, 4, 1, 0, 1, 4, 3, 4, 1, 0, 1, 4, 2, 2, 4, 1, 0, 1, 4, 1, 0, 1, 4, 1, 0, 1, 4, 0, 7, 7, 0, 4, 1, 0, 1, 4, 9, 6, 5, 6, 9, 4, 1, 0, 1, 4, 9, 5, 3, 3, 5, 9, 4, 1, 0, 1, 4, 9, 4, 1, 0, 1, 4, 9, 4, 1, 0, 1, 4, 9, 3, 12, 10, 10, 12, 3, 9, 4, 1
Offset: 1

Views

Author

Jon E. Schoenfield, Apr 26 2021

Keywords

Comments

Similar to A048152 and A060036, but each row in this sequence begins at k = 0 and ends at k = n-1 (the minimum and maximum residues modulo n, respectively).

Examples

			Triangle begins:
  n\k| 0  1  2  3  4  5  6  7  8  9 10 11
  ---+-----------------------------------
   1 | 0
   2 | 0, 1
   3 | 0, 1, 1
   4 | 0, 1, 0, 1
   5 | 0, 1, 4, 4, 1
   6 | 0, 1, 4, 3, 4, 1
   7 | 0, 1, 4, 2, 2, 4, 1
   8 | 0, 1, 4, 1, 0, 1, 4, 1
   9 | 0, 1, 4, 0, 7, 7, 0, 4, 1
  10 | 0, 1, 4, 9, 6, 5, 6, 9, 4, 1
  11 | 0, 1, 4, 9, 5, 3, 3, 5, 9, 4, 1
  12 | 0, 1, 4, 9, 4, 1, 0, 1, 4, 9, 4, 1
		

Crossrefs

Programs

Formula

T(n,k) = k^2 mod n.
T(n,k) = T(n,n-k).

A306284 a(n) is the smallest positive integer x such that x > y >= 0 and n divides x^2 - y^2.

Original entry on oeis.org

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

Views

Author

Jianing Song, Feb 03 2019

Keywords

Comments

Different from A306271: here x^2 mod n is not necessarily a square. For most n, a(n) != A306271(n).
It seems that n divides a(n)^2 if and only if n divides A306271(n)^2.
a(n) >= sqrt(n) with equality if and only if n is a square. - Robert Israel, Feb 05 2019

Examples

			a(10) = 6 because 10 divides 6^2 - 4^2 = 10, and 6 is the smallest possible value for x such that x > y >= 0 and that 10 divides x^2 - y^2.
a(87) = 16 because 87 divides 16^2 - 13^2 = 87, and 16 is the smallest possible value for x such that x > y >= 0 and that 87 divides x^2 - y^2.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local S, x,t;
    S:= {0}:
    for x from 1 do
      t:= x^2 mod n;
      if member(t,S) then return x
        else S:= S union {t}
      fi
    od
    end proc:
    map(f, [$1..100]); # Robert Israel, Feb 05 2019
  • PARI
    a(n) = for(x=1, n, for(y=0, x-1, if((x^2-y^2)%n==0, return(x))))
    
  • Python
    from itertools import count
    def A306284(n):
        y, a = 0, set()
        for x in count(0):
            if y in a: return x
            a.add(y)
            y = (y+(x<<1)+1)%n # Chai Wah Wu, Apr 25 2024

Formula

a(n^2) = n.
a(p) = (p + 1)/2 for primes p > 2.
For odd primes p and q, a(p*q) = (p+q)/2. - Robert Israel, Feb 08 2019

A344851 a(n) = (n^2) mod (2^A070939(n)).

Original entry on oeis.org

0, 1, 0, 1, 0, 1, 4, 1, 0, 1, 4, 9, 0, 9, 4, 1, 0, 1, 4, 9, 16, 25, 4, 17, 0, 17, 4, 25, 16, 9, 4, 1, 0, 1, 4, 9, 16, 25, 36, 49, 0, 17, 36, 57, 16, 41, 4, 33, 0, 33, 4, 41, 16, 57, 36, 17, 0, 49, 36, 25, 16, 9, 4, 1, 0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100
Offset: 0

Views

Author

Rémy Sigrist, May 30 2021

Keywords

Comments

Informally, if n has w binary digits, a(n) is obtained by keeping the w final binary digits of n^2.
For n > 0, a(n) is the final digit of n^2 in base A062383(n).
This sequence has interesting graphical features (see illustration in Links section).

Examples

			For n = 42:
- A070939(42) = 6,
- a(42) = (42^2) mod (2^6) = 1764 mod 64 = 36.
		

Crossrefs

Cf. A000290, A048152, A062383, A070939, A086341, A116882, A316347 (decimal analog).

Programs

  • Mathematica
    {0}~Join~Table[Mod[n^2,2^(1+Floor@Log2@n)],{n,100}] (* Giorgos Kalogeropoulos, Jun 02 2021 *)
  • PARI
    a(n) = (n^2) % 2^#binary(n)
    
  • Python
    def a(n): return (n**2) % (2**n.bit_length())
    print([a(n) for n in range(75)]) # Michael S. Branicky, May 30 2021

Formula

a(n) = 0 iff n = 0 or n > 1 and n belongs to A116882.
a(n) = 1 iff n belongs to A086341.
a(2^k + m) = a(2^(k+1)-m) for any k > 0 and m = 0..2^k.

A228587 Sum of the squares (modulo n) of the odd numbers less than n.

Original entry on oeis.org

0, 1, 1, 2, 5, 5, 7, 4, 12, 25, 22, 22, 39, 49, 35, 40, 68, 69, 76, 50, 91, 77, 92, 44, 125, 169, 144, 182, 203, 205, 186, 208, 242, 289, 245, 210, 333, 285, 286, 180, 410, 413, 430, 374, 420, 529, 423, 376, 490, 625, 578, 546, 689, 585, 605, 476, 760, 841, 767, 710
Offset: 1

Views

Author

R. J. Mathar, Aug 27 2013

Keywords

Comments

Sum over the odd-numbered columns in row n of A048152.

Crossrefs

Cf. A000447.

Programs

  • Maple
    A228587 := proc(n)
            local a,o ;
            a := 0 ;
            for o from 1 to n-1 by 2 do
                    a := a+ modp(o^2,n) ;
            end do:
            a ;
    end proc:

Formula

a(n) = sum_{k=1,3,5,...,n-1} (k^2 mod n).
a(n) <= A048153(n).
A187468(n) = a(2^n).
Previous Showing 11-17 of 17 results.