%I #26 Apr 18 2022 09:47:05
%S 2,25,256,256036,2560361612769,256036161276932002260000001,
%T 256036161276932002260000001607597862784080913990785121
%N a(n+1) is next smallest square not divisible by 10 beginning with a(n), initial term is 2.
%C a(12) has 1717 digits. - _Michael S. Branicky_, Feb 25 2021
%H Michael S. Branicky, <a href="/A249893/b249893.txt">Table of n, a(n) for n = 1..11</a> (terms 1..10 from Hiroaki Yamanouchi)
%o (PARI) a(n)=k=n;s=1;while(s<5*10^7,if(s%10,if(s^2\(10^(#Str(s^2)-#Str(k)))==k,print1(s^2,", ");k=s^2));s++)
%o a(2)
%o (Python)
%o def f(x):
%o ..print(x,end=', ')
%o ..n = x
%o ..s = 1
%o ..while s < 10**7:
%o ....if s % 10:
%o ......S = str(s**2)
%o ......if S.startswith(str(n)):
%o ........print(s**2,end=', ')
%o ........n = s**2
%o ....s += 1
%o f(2)
%o (Python)
%o from math import isqrt
%o def anext(an):
%o lo, hi = an*10, an*10 + 9
%o while True:
%o found = False
%o if isqrt(hi)**2 > lo: return (isqrt(lo)+1)**2
%o lo, hi = lo*10, hi*10 + 9
%o n, an = 1, 2
%o for n in range(2, 17):
%o an = anext(an)
%o print(n, an) # _Michael S. Branicky_, Feb 25 2021
%Y Cf. A048559, A048561.
%K nonn,base
%O 1,1
%A _Derek Orr_, Nov 08 2014
|