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-2 of 2 results.

A306257 a(n) = t for the minimal integer k > t such that k^2 mod n = t^2 is a perfect square.

Original entry on oeis.org

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

Views

Author

Alois P. Heinz, Feb 13 2019

Keywords

Crossrefs

Cf. A000290, A077591, A306271 (values of k).

Programs

  • Maple
    a:= proc(n) local k; for k from (s-> `if`(s^2
    				

Formula

a(n) = 0 <=> n > 0 and n in { A000290 } union { A077591 }.

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
Showing 1-2 of 2 results.