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.

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

This page as a plain text file.
%I A306284 #29 Apr 26 2024 04:03:51
%S A306284 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,
%T A306284 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,
%U A306284 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
%N A306284 a(n) is the smallest positive integer x such that x > y >= 0 and n divides x^2 - y^2.
%C A306284 Different from A306271: here x^2 mod n is not necessarily a square. For most n, a(n) != A306271(n).
%C A306284 It seems that n divides a(n)^2 if and only if n divides A306271(n)^2.
%C A306284 a(n) >= sqrt(n) with equality if and only if n is a square. - _Robert Israel_, Feb 05 2019
%H A306284 Robert Israel, <a href="/A306284/b306284.txt">Table of n, a(n) for n = 1..10000</a>
%F A306284 a(n^2) = n.
%F A306284 a(p) = (p + 1)/2 for primes p > 2.
%F A306284 For odd primes p and q, a(p*q) = (p+q)/2. - _Robert Israel_, Feb 08 2019
%e A306284 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.
%e A306284 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.
%p A306284 f:= proc(n) local S, x,t;
%p A306284 S:= {0}:
%p A306284 for x from 1 do
%p A306284   t:= x^2 mod n;
%p A306284   if member(t,S) then return x
%p A306284     else S:= S union {t}
%p A306284   fi
%p A306284 od
%p A306284 end proc:
%p A306284 map(f, [$1..100]); # _Robert Israel_, Feb 05 2019
%o A306284 (PARI) a(n) = for(x=1, n, for(y=0, x-1, if((x^2-y^2)%n==0, return(x))))
%o A306284 (Python)
%o A306284 from itertools import count
%o A306284 def A306284(n):
%o A306284     y, a = 0, set()
%o A306284     for x in count(0):
%o A306284         if y in a: return x
%o A306284         a.add(y)
%o A306284         y = (y+(x<<1)+1)%n # _Chai Wah Wu_, Apr 25 2024
%Y A306284 Cf. A048152, A306271.
%K A306284 nonn,look
%O A306284 1,2
%A A306284 _Jianing Song_, Feb 03 2019