OFFSET
1,1
COMMENTS
This sequence only includes numbers which produce arithmetic sequences of at least three terms (and in fact, no squares containing sequences of more than three terms have been found).
LINKS
Michel Marcus, Table of n, a(n) for n = 1..142 (up to 10^8)
EXAMPLE
11142^2 = 124144164 and 124,144,164 is an arithmetic sequence.
PROG
(Python)
from itertools import count
def check(n, power):
np = str(n**power)
l=len(np)
for chunks in range(3, 5):
if l%chunks==0:
step = l//chunks
bits = [int(np[i:i+step]) for i in range(0, l, step)]
diff = bits[1]-bits[0]
old=bits[1]
go = True
for bit in bits[2:]:
if bit-old!=diff:
go=False
break
old = bit
if go:
return True
for n in count(1):
if check(n, 2):
print(n)
(PARI) isoneap(vch) = {r = vch[2] - vch[1]; for (i=3, #vch, if (vch[i] - vch[i-1] != r, return (0)); ); return (1); }
isap(vd, nch, nd) = {npch = nd/nch; vch = vector(nch); ich = 1; inew = 1; for (i=1, nd, if (inew, vch[ich] = vd[i]; inew = 0; , vch[ich] = 10*vch[ich] + vd[i]); if ((i % npch) == 0, ich++; inew = 1); ); isoneap(vch); }
isok(n) = {vd = digits(n^2); nd = #vd; if (isprime(nd), return(0)); ok = 0; fordiv(nd, nch, if (nch > 2, if(isap(vd, nch, nd), return (1))); ); return (0); } \\ Michel Marcus, Jul 06 2014
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Christian Perfect, Jul 04 2014
STATUS
approved
