The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
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!)
A065796 Alternating sum of digits of n^2. 3
1, 4, 9, 5, 3, 3, 5, -2, -7, 1, 0, 1, 4, -2, 5, 3, 3, 5, -2, 4, 1, 0, 12, 4, 9, 5, 14, 3, 5, 9, 4, 1, 0, 1, 4, -2, 5, 3, 3, 5, -2, 4, 12, 11, 1, 4, 9, 5, 3, 3, 5, 9, 15, 12, 0, 1, 4, -2, -6, 3, 3, 5, 9, -7, 1, 0, 1, 4, -2, 5, -8, -8, 5, -2, 4, 1, 11, -10, -7, -2, -6, 3, 3, -6, -2, -7, 1, 0, 1, -7, -13, -6, 3, 3, -6, -2, 4, 1, 0, 1 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
Conjecture; there are an infinite number of values which do not appear in this sequence (in the signed version, of course). The first example appears to be 2. Sean A. Irvine has checked this up to 10^9. - Robert G. Wilson v, Dec 10 2001
a(n) == n^2 (mod 11). In particular, values == 2, 6, 7, 8, 10 (mod 11) do not appear, and the conjecture is true. - Robert Israel, Oct 24 2017
LINKS
FORMULA
a(n) = n^2 mod 10 - n^2 mod 100 div 10 + n^2 mod 1000 div 100 - ...
a(n) = A055017(n^2). - Robert Israel, Oct 24 2017
EXAMPLE
a(18)=5 because 18^2 is 324 and 4-2+3=5
MAPLE
asd:= proc(n) local L, j;
L:= convert(n, base, 10);
add((-1)^(j+1)*L[j], j=1..nops(L))
end proc:
seq(asd(n^2), n=1..100); # Robert Israel, Oct 24 2017
MATHEMATICA
f[n_] := Block[ {d = Reverse[ IntegerDigits[ n]], k = l = 1, s = 0}, l = Length[d]; While[ k <= l, s = s - (-1)^k*d[[k]]; k++ ]; Return[s]]; Table[ f[n^2], {n, 1, 100} ]
Table[Total[Times@@@Partition[Riffle[IntegerDigits[n^2], {1, -1}, {-2, 1, -2}], 2]], {n, 1, 100}] (* Vincenzo Librandi, Oct 24 2017 *)
PROG
(PARI) SumAD(x)= { local(a=1, s=0); while (x>9, s+=a*(x-10*(x\10)); x\=10; a=-a); return(s + a*x) }
{ for (n=1, 1000, write("b065796.txt", n, " ", SumAD(n^2)) ) } \\ Harry J. Smith, Oct 30 2009
CROSSREFS
Cf. A055017.
Sequence in context: A011513 A340350 A164818 * A070434 A011003 A344078
KEYWORD
base,easy,sign
AUTHOR
Benny Wegner (jaeger(AT)clan-efg.de), Dec 05 2001
EXTENSIONS
More terms from Robert G. Wilson v, Dec 06 2001
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 June 17 05:47 EDT 2024. Contains 373432 sequences. (Running on oeis4.)