login
The smallest pronic (A002378) with the same most significant digits as n.
1

%I #7 Dec 02 2021 10:13:32

%S 12,2,30,42,56,6,72,812,90,1056,110,12,132,1406,156,1640,1722,182,

%T 1980,20,210,2256,2352,240,2550,2652,272,2862,2970,30,3192,32220,3306,

%U 342,3540,3660,3782,380,3906,4032,4160,42,43056,4422,4556,462,47306,4830

%N The smallest pronic (A002378) with the same most significant digits as n.

%H Michael S. Branicky, <a href="/A163599/b163599.txt">Table of n, a(n) for n = 1..10000</a>

%p A002378 := proc(n) n*(n+1) ; end:

%p A163599 := proc(n) ndgs := convert(n,base,10) ; for i from 1 do wrks := true ; prd := convert( A002378(i),base,10) ; for d from 1 to nops(ndgs) do if op(-d,ndgs) <> op(-d,prd) then wrks := false; break; fi; od: if wrks then RETURN( A002378(i) ) ; fi; od: end:

%p seq(A163599(n),n=1..80) ; # _R. J. Mathar_, Aug 07 2009

%o (Python)

%o from sympy import isprime

%o def a(n):

%o s, k = str(n), 1

%o while not str(k*(k+1)).startswith(s): k += 1

%o return k*(k+1)

%o print([a(n) for n in range(1, 49)]) # _Michael S. Branicky_, Dec 02 2021

%K nonn,base

%O 1,1

%A _Claudio Meller_, Aug 01 2009