login
A367360
Comma transform of squares.
15
1, 14, 49, 91, 62, 53, 64, 96, 48, 11, 1, 11, 41, 91, 62, 52, 62, 93, 43, 14, 4, 14, 45, 95, 66, 56, 67, 97, 48, 19, 9, 11, 41, 91, 61, 51, 61, 91, 41, 11, 1, 11, 41, 91, 62, 52, 62, 92, 42, 12, 2, 12, 42, 92, 63, 53, 63, 93, 43, 13, 3, 13, 43, 94, 64, 54, 64, 94, 44, 14, 5, 15, 45, 95, 65, 55, 65, 96, 46, 16, 6, 16, 46, 97
OFFSET
0,2
COMMENTS
To compute the comma transform of a sequence [b,c,d,e,f,...], concatenate the last digit of each term with the first digit of the following term. In other words, these are the numbers formed by the pairs of digits that surround the commas that separate the terms of the original sequence.
The comma transform CT(S) of a sequence S of positive numbers maps S into the set F consisting of finite or infinite sequences of positive numbers each with one or two digits. The inverse comma transform CTi maps an element of F to an element of F.
Inspired by Eric Angelini's A121805.
LINKS
FORMULA
a(n) = 10 * A008959(n) + A002993(n+1). - Alois P. Heinz, Nov 22 2023
EXAMPLE
The squares are 0, 1, 4, 9, 16, 25, ..., so the comma transform is [0]1, 14, 49, 91, 62, ...
MAPLE
Maple code for comma transform (CT(a)) of a sequence a:
# leading digit, from A000030
Ldigit:=proc(n) local v; v:=convert(n, base, 10); v[-1]; end;
CT:=proc(a) local b, i; b:=[];
for i from 1 to nops(a)-1 do
b := [op(b), 10*(a[i] mod 10) + Ldigit(a[i+1])]; od: b; end;
# Inverse comma transform of sequence A calculated in base "bas": - N. J. A. Sloane, Jan 03 2024
bas := 10;
Ldigit:=proc(n) local v; v:=convert(n, base, bas); v[-1]; end;
CTi := proc(A) local B, i, L, R;
for i from 1 to nops(A) do
if A[i]>=bas^2 then error("all terms must have 1 or 2 digits"); fi; od:
B:=Array(1..nops(A), -1);
if A[1] >= bas then B[1]:= Ldigit(A[1]); L:=(A[1] mod bas);
else B[1]:=10; L:=A[1];
fi;
for i from 2 to nops(A) do
if A[i] >= bas then R := Ldigit(A[i]) else R:=0; fi;
B[i] := L*bas + R;
L := (A[i] mod bas);
od;
B;
end;
# second Maple program:
a:= n-> parse(cat(""||(n^2)[-1], ""||((n+1)^2)[1])):
seq(a(n), n=0..99); # Alois P. Heinz, Nov 22 2023
MATHEMATICA
a[n_]:=FromDigits[{Last[IntegerDigits[n^2]], First[IntegerDigits[(n+1)^2]]}];
a/@Range[0, 83] (* Ivan N. Ianakiev, Nov 24 2023 *)
PROG
(Python)
from itertools import count, islice, pairwise
def S(): yield from (str(i**2) for i in count(0))
def agen(): yield from (int(t[-1]+u[0]) for t, u in pairwise(S()))
print(list(islice(agen(), 84))) # Michael S. Branicky, Nov 22 2023
(Python)
def A367360(n): return (0, 10, 40, 90, 60, 50, 60, 90, 40, 10)[n%10]+int(str((n+1)**2)[0]) # Chai Wah Wu, Dec 22 2023
CROSSREFS
A166499 is the comma transform of the primes, A367361 of the powers of 2, A367362 of the nonnegative integers. See also A368362.
Sequence in context: A039340 A043163 A043943 * A308834 A084049 A251221
KEYWORD
nonn,base
AUTHOR
N. J. A. Sloane, Nov 22 2023.
STATUS
approved