login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A350037 a(n) = n^2 mod round(sqrt(n)). 1
0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 4, 4, 1, 0, 1, 4, 4, 1, 0, 1, 4, 3, 4, 1, 0, 1, 4, 3, 4, 1, 0, 1, 4, 2, 2, 4, 1, 0, 1, 4, 2, 2, 4, 1, 0, 1, 4, 1, 0, 1, 4, 1, 0, 1, 4, 1, 0, 1, 4, 1, 0, 1, 4, 0, 7, 7, 0, 4, 1, 0, 1, 4, 0, 7, 7, 0, 4 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,22
LINKS
FORMULA
a(n) = A000290(n) mod A000194(n). - Michel Marcus, Dec 14 2021
EXAMPLE
a(5) = 5^2 mod round(sqrt(5)) = 25 mod 2 = 1.
MATHEMATICA
a[n_] := Mod[n^2, Round @ Sqrt[n]]; Array[a, 100, 2] (* Amiram Eldar, Dec 10 2021 *)
Table[PowerMod[n, 2, Round[Sqrt[n]]], {n, 2, 101}] (* Stefano Spezia, Dec 15 2021 *)
PROG
(Java)
import java.util.Arrays;
public class modulus_sequence {
static int[] solutions = new int[480];
static int a_of_n (double n) {
int z = (int)Math.round(Math.sqrt(n));
int w = (int)(Math.pow(n, 2));
int k = w%z;
return k;
}
public static void main(String[] args) {
for (double j = 2; j < 482; j++) {
int h = a_of_n(j);
solutions[(int) (j-2)]=h;
}
System.out.println(Arrays.toString(solutions));
}
}
(PARI) a(n) = n^2 % round(sqrt(n)); \\ Michel Marcus, Dec 14 2021
(PARI) a(n) = lift(Mod(n, ((sqrtint(4*n) + 1)\2))^2); \\ Michel Marcus, Dec 14 2021
(Python)
from math import isqrt
def A350037(n): return pow(n, 2, (m:=isqrt(n))+int(4*n>=(2*m+1)**2)) # Chai Wah Wu, Jan 10 2022
CROSSREFS
Cf. A336302 (with ceiling instead of round).
Sequence in context: A185057 A343720 A048152 * A070430 A336302 A163353
KEYWORD
nonn,easy
AUTHOR
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 23 22:36 EDT 2024. Contains 371917 sequences. (Running on oeis4.)