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.

A034945 Successive approximations to 7-adic integer sqrt(2).

This page as a plain text file.
%I A034945 #32 Dec 05 2022 11:06:29
%S A034945 0,3,10,108,2166,4567,38181,155830,1802916,24862120,266983762,
%T A034945 1961835256,5916488742,19757775943,116646786350,9611769806236,
%U A034945 42844700375837,275475214363044,6789129606004840,75182500718243698
%N A034945 Successive approximations to 7-adic integer sqrt(2).
%D A034945 K. Mahler, Introduction to p-Adic Numbers and Their Functions, Cambridge, 1973, p. 35.
%H A034945 Seiichi Manyama, <a href="/A034945/b034945.txt">Table of n, a(n) for n = 0..1010</a>
%o A034945 (PARI) seq(n)={my(v=vector(n), i=1, k=0); while(i<#v, k++; my(t=truncate(sqrt(2 + O(7^k)))); if(t > v[i], i++; v[i]=t)); v} \\ _Andrew Howroyd_, Nov 03 2018
%o A034945 (Ruby)
%o A034945 def A034945(n)
%o A034945   ary = [0]
%o A034945   a, mod = 3, 7
%o A034945   while ary.size - 1 < n
%o A034945     b = a % mod
%o A034945     ary << b if b != ary[-1]
%o A034945     a = b * b + b - 2
%o A034945     mod *= 7
%o A034945   end
%o A034945   ary
%o A034945 end
%o A034945 p A034945(100) # _Seiichi Manyama_, Aug 03 2017
%o A034945 (Python)
%o A034945 def a034945(n):
%o A034945     ary=[0]
%o A034945     a, mod=3, 7
%o A034945     while len(ary) - 1<n:
%o A034945         b=a%mod
%o A034945         if b!=ary[-1]: ary.append(b)
%o A034945         a=b**2 + b - 2
%o A034945         mod*=7
%o A034945     return ary
%o A034945 print(a034945(100)) # _Indranil Ghosh_, Aug 03 2017, after Ruby
%Y A034945 Cf. A290557.
%K A034945 nonn,easy
%O A034945 0,2
%A A034945 _N. J. A. Sloane_