OFFSET
0,7
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).
LINKS
Rémy Sigrist, Table of n, a(n) for n = 0..8192
John S. McCaskill and Peter R.Wills, On permutations derived from integer powers x^n, arXiv:1907.01890 [math.NT], 2019.
Rémy Sigrist, Scatterplot of the sequence for n = 2^18..2^19
FORMULA
EXAMPLE
MATHEMATICA
{0}~Join~Table[Mod[n^2, 2^(1+Floor@Log2@n)], {n, 100}] (* Giorgos Kalogeropoulos, Jun 02 2021 *)
PROG
(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
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Rémy Sigrist, May 30 2021
STATUS
approved