%I #14 Nov 22 2022 22:28:01
%S 1,1,2,0,0,2,0,1,0,0,0,2,1,2,0,1,0,1,1,0,2,2,0,1,1,1,2,2,2,0,0,0,2,1,
%T 0,1,2,0,2,2,0,2,0,1,2,0,1,2,2,2,1,0,2,0,1,2,0,2,0,0,1,1,2,1,0,1,2,1,
%U 1,2,0
%N Digits of one of the two 3-adic integers sqrt(-2).
%C This is the scaled first difference sequence of A268924. See the formula.
%C The digits of the other 3-adic integer sqrt(-2), are given in A271224. See also A268924 for the two 3-adic numbers sqrt(-2), called there u and -u.
%C a(n) is the unique solution of the linear congruence 2*A268924(n)*a(n) + A271225(n) == 0 (mod 3), n>=1. Therefore only the values 0, 1, and 2 appear. See the Nagell reference given in A268922, eq. (6) on p. 86, adapted to this case. a(0) = 1 follows from the formula given below.
%C For details see the Wolfdieter Lang link under A268992.
%C The first k digits in the base 3 representation of Lucas(3^n) give the first k terms of the sequence. For example, the base 3 representation of Lucas(3^5) = 84722519070079276 begins 1 + 1*3 + 2*(3^2) + 0*(3^3) + 0*(3^4) + ... so the sequence begins [1, 1, 2, 0, 0, ...]. - _Peter Bala_, Nov 15 2022
%D Trygve Nagell, Introduction to Number Theory, Chelsea Publishing Company, New York, 1964, pp. 86 and 77-78.
%H Seiichi Manyama, <a href="/A271223/b271223.txt">Table of n, a(n) for n = 0..10000</a>
%H BCMATH Congruence Programs, <a href="http://www.numbertheory.org/php/p-adic.html">Finding a p-adic square root of a quadratic residue (mod p), p an odd prime.</a>
%F a(n) = (b(n+1) - b(n))/3^n, n >= 0, with b(n) = A268924(n), n >= 0.
%F a(n) = - A271225(n)*2*A268924(n) (mod 3), n >= 1. Solution of the linear congruence given above in a comment. See, e.g., Nagell, Theorem 38 pp. 77-78.
%F A268924(n+1) = sum(a(k)*3^k, k=0..n), n >= 0.
%e a(4) = 0 because 2*22*3 + 6 = 138 == 0 (mod 3).
%e a(4) = - 6*(2*22) (mod 3) = -0*(2*1) (mod 3) = 0.
%e A268924(5) = 22 = 1*3^0 + 1*3^1 + 2*3^2 + 0*3^3 + 0*3^4.
%p # uses properties of the numbers Lucas(3^n) = A006267(n)
%p a := proc(n) option remember; if n = 1 then 1 else irem(a(n-1)^3 + 3*a(n-1), 3^n) end if; end proc:
%p convert(a(70), base, 3); # _Peter Bala_, Nov 15 2022
%o (PARI) a(n) = truncate(sqrt(-2+O(3^(n+1))))\3^n; \\ _Michel Marcus_, Apr 09 2016
%Y Cf. A006267, A268924, A268992, A271224, A271225.
%K nonn,base,easy
%O 0,3
%A _Wolfdieter Lang_, Apr 05 2016